1. Intermittently failing test cases.

2. Dialog vertical position should be more on the upper side.
3. File not supported error is not showing.

refs #7313
This commit is contained in:
Aditya Toshniwal 2022-07-25 11:48:27 +05:30 committed by Akshay Joshi
parent 96c360e728
commit a7fd7d67b3
3 changed files with 11 additions and 4 deletions

View File

@ -168,7 +168,7 @@ function PaperComponent(props) {
return props.isfullscreen == 'true' ? { x: 0, y: 0 } : dialogPosition && { x: dialogPosition.x, y: dialogPosition.y };
};
const y_position = props.height ? (window.innerHeight/2) - (props.height/2) : (window.innerHeight/2) - (MIN_HEIGHT/2);
const y_position = window.innerHeight*0.02; // 2% of total height
const x_position = props.width ? (window.innerWidth/2) - (props.width/2) : (window.innerWidth/2) - (MIN_WIDTH/2);
return (

View File

@ -349,7 +349,12 @@ export default function Query() {
eventBus.registerListener(QUERY_TOOL_EVENTS.LOAD_FILE, (fileName)=>{
queryToolCtx.api.post(url_for('sqleditor.load_file'), {
'file_name': decodeURI(fileName),
}, {transformResponse: [(data) => { return data; }]}).then((res)=>{
}, {transformResponse: [(data, headers) => {
if(headers['content-type'].includes('application/json')) {
return JSON.parse(data);
}
return data;
}]}).then((res)=>{
editor.current.setValue(res.data);
//Check the file content for Trojan Source
checkTrojanSource(res.data);

View File

@ -98,7 +98,6 @@ describe('FileManger', ()=>{
beforeAll(()=>{
mount = createMount();
networkMock = new MockAdapter(axios);
networkMock.onPost('/file_manager/init').reply(200, {'data': configData});
networkMock.onPost(`/file_manager/filemanager/${transId}/`).reply(200, {data: {result: files}});
networkMock.onPost(`/file_manager/save_file_dialog_view/${transId}`).reply(200, {});
networkMock.onDelete(`/file_manager/delete_trans_id/${transId}`).reply(200, {});
@ -130,14 +129,17 @@ describe('FileManger', ()=>{
};
it('init', (done)=>{
networkMock.onPost('/file_manager/init').reply(200, {'data': configData});
let ctrl = ctrlMount({});
setTimeout(()=>{
ctrl.update();
ctrl.find('button[name="menu-options"]').simulate('click');
ctrl.find('Memo(MenuItem)[data-label="List View"]').simulate('click');
ctrl.update();
expect(ctrl.find('ListView').length).toBe(1);
expect(ctrl.find('GridView').length).toBe(0);
expect(ctrl.find('InputText[data-label="file-path"]').prop('value')).toBe('/home/current');
ctrl.find('button[name="menu-options"]').simulate('click');
ctrl.update();
ctrl.find('Memo(MenuItem)[data-label="Grid View"]').simulate('click');
setTimeout(()=>{
ctrl.update();