Fixed Jasmine test cases.

This commit is contained in:
Khushboo Vashi 2020-10-21 22:14:10 +05:30 committed by Akshay Joshi
parent 275d13d40f
commit 9b4317fb25

View File

@ -65,8 +65,59 @@ describe('fileSelectDialog', function () {
}, },
}; };
describe('When dialog is called for select file', () => { describe('When dialog is called for', () => {
it('Select file dialog', function() {
beforeEach(() => {
pgAdmin.Browser = {
stdW: {
sm: 500,
md: 700,
lg: 900,
default: 500,
calc: (passed_width) => {
let iw = window.innerWidth;
if(iw > passed_width){
return passed_width;
}else{
if (iw > pgAdmin.Browser.stdW.lg)
return pgAdmin.Browser.stdW.lg;
else if (iw > pgAdmin.Browser.stdW.md)
return pgAdmin.Browser.stdW.md;
else if (iw > pgAdmin.Browser.stdW.sm)
return pgAdmin.Browser.stdW.sm;
else
// if avilable screen resolution is still
// less then return the width value as it
return iw;
}
},
},
stdH: {
sm: 200,
md: 400,
lg: 550,
default: 550,
calc: (passed_height) => {
// We are excluding sm as it is too small for dialog
let ih = window.innerHeight;
if (ih > passed_height){
return passed_height;
}else{
if (ih > pgAdmin.Browser.stdH.lg)
return pgAdmin.Browser.stdH.lg;
else if (ih > pgAdmin.Browser.stdH.md)
return pgAdmin.Browser.stdH.md;
else
// if avilable screen resolution is still
// less then return the height value as it
return ih;
}
},
},
};
});
it('Select file', function() {
params = { params = {
'dialog_title': 'Select file', 'dialog_title': 'Select file',
'dialog_type': 'select_file', 'dialog_type': 'select_file',
@ -81,10 +132,8 @@ describe('fileSelectDialog', function () {
expect(Alertify.fileSelectionDlg).toHaveBeenCalled(); expect(Alertify.fileSelectionDlg).toHaveBeenCalled();
}); });
});
describe('When dialog is called for create file', () => { it('create file', function() {
it('Select file dialog', function() {
params = { params = {
'dialog_title': 'Create file', 'dialog_title': 'Create file',
'dialog_type': 'create_file', 'dialog_type': 'create_file',