mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed the issues for all the javascript files reported by the liner.
This commit is contained in:
@@ -12,16 +12,16 @@ define([
|
||||
'pgadmin.backform',
|
||||
], function ($, Backbone, Backform) {
|
||||
describe('KeyboardshortcutControl', function () {
|
||||
let field, innerFields, control, model, event;
|
||||
let field, innerFields, control, model;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
innerFields = [
|
||||
{'name': 'key', 'type': 'keyCode', 'label': 'Key'},
|
||||
{'name': 'alt_option', 'type': 'checkbox',
|
||||
'label': 'Alt/Option'},
|
||||
'label': 'Alt/Option'},
|
||||
{'name': 'control', 'type': 'checkbox',
|
||||
'label': 'Ctrl'},
|
||||
'label': 'Ctrl'},
|
||||
{'name': 'shift', 'type': 'checkbox', 'label': 'Shift'},
|
||||
];
|
||||
|
||||
@@ -91,7 +91,7 @@ define([
|
||||
'key': {
|
||||
'key_code': 65,
|
||||
'char': 'A',
|
||||
}
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
@@ -128,7 +128,7 @@ define([
|
||||
|
||||
model.set(field.get('name'),
|
||||
$.extend(true, val, {
|
||||
'control': false
|
||||
'control': false,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -165,7 +165,7 @@ define([
|
||||
|
||||
model.set(field.get('name'),
|
||||
$.extend(true, val, {
|
||||
'shift': true
|
||||
'shift': true,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -202,7 +202,7 @@ define([
|
||||
|
||||
model.set(field.get('name'),
|
||||
$.extend(true, val, {
|
||||
'alt_option': false
|
||||
'alt_option': false,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -387,14 +387,14 @@ define([
|
||||
// this should change
|
||||
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeFalsy();
|
||||
expect(model.get(field.get('name'))).toEqual({
|
||||
'control': true,
|
||||
'shift': false,
|
||||
'alt_option': false,
|
||||
'key': {
|
||||
'key_code': 73,
|
||||
'char': 'I',
|
||||
},
|
||||
});
|
||||
'control': true,
|
||||
'shift': false,
|
||||
'alt_option': false,
|
||||
'key': {
|
||||
'key_code': 73,
|
||||
'char': 'I',
|
||||
},
|
||||
});
|
||||
|
||||
// below three should not change.
|
||||
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
|
||||
@@ -431,4 +431,4 @@ define([
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,8 +18,8 @@ define([
|
||||
'key': {
|
||||
'key_code': 65,
|
||||
'char': 'A',
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
field = new Backform.Field({
|
||||
id: 'key',
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import $ from 'jquery'
|
||||
import modifyAnimation from 'sources/modify_animation'
|
||||
import $ from 'jquery';
|
||||
import modifyAnimation from 'sources/modify_animation';
|
||||
|
||||
|
||||
describe('modifyAnimation', function () {
|
||||
@@ -16,12 +16,12 @@ describe('modifyAnimation', function () {
|
||||
let dummyElement;
|
||||
|
||||
beforeEach(() => {
|
||||
pgBrowser = jasmine.createSpyObj('pgBrowser', ['get_preference', 'tree'])
|
||||
pgBrowser = jasmine.createSpyObj('pgBrowser', ['get_preference', 'tree']);
|
||||
pgBrowser.tree = jasmine.createSpyObj('tree', ['options']);
|
||||
pgBrowser.tree.options.and.returnValue({
|
||||
show: {},
|
||||
hide: {},
|
||||
view: {},
|
||||
show: {},
|
||||
hide: {},
|
||||
view: {},
|
||||
});
|
||||
dummyElement = document.createElement('link');
|
||||
spyOn($.fn, 'find').and.returnValue($(dummyElement));
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('Server#ModelValidation', () => {
|
||||
expect(model.errorModel.set).toHaveBeenCalledWith({
|
||||
host: 'Either Host name, Address or Service must be specified.',
|
||||
hostaddr: 'Either Host name, Address or Service must be specified.',
|
||||
db: 'Maintenance database must be specified.'
|
||||
db: 'Maintenance database must be specified.',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -81,7 +81,7 @@ describe('Server#ModelValidation', () => {
|
||||
hostaddr: 'Either Host name, Address or Service must be specified.',
|
||||
db: 'Maintenance database must be specified.',
|
||||
username: 'Username must be specified.',
|
||||
port: 'Port must be specified.'
|
||||
port: 'Port must be specified.',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -96,7 +96,7 @@ describe('Server#ModelValidation', () => {
|
||||
hostaddr: 'Host address must be valid IPv4 or IPv6 address.',
|
||||
db: 'Maintenance database must be specified.',
|
||||
username: 'Username must be specified.',
|
||||
port: 'Port must be specified.'
|
||||
port: 'Port must be specified.',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -109,7 +109,7 @@ describe('Server#ModelValidation', () => {
|
||||
expect(model.errorModel.set).toHaveBeenCalledWith({
|
||||
name: 'Name must be specified.',
|
||||
username: 'Username must be specified.',
|
||||
port: 'Port must be specified.'
|
||||
port: 'Port must be specified.',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
import keyboardShortcuts from 'sources/keyboard_shortcuts';
|
||||
|
||||
describe('the keyboard shortcuts', () => {
|
||||
const F1_KEY = 112,
|
||||
EDIT_KEY = 71, // Key: G -> Grid values
|
||||
LEFT_ARROW_KEY = 37,
|
||||
RIGHT_ARROW_KEY = 39,
|
||||
MOVE_NEXT = 'right';
|
||||
const F1_KEY = 112;
|
||||
// const EDIT_KEY = 71; // Key: G -> Grid values
|
||||
// const LEFT_ARROW_KEY = 37;
|
||||
// const RIGHT_ARROW_KEY = 39;
|
||||
// const MOVE_NEXT = 'right';
|
||||
|
||||
let debuggerElementSpy, event, debuggerUserShortcutSpy;
|
||||
debuggerUserShortcutSpy = jasmine.createSpyObj(
|
||||
'userDefinedShortcuts', [
|
||||
{ 'edit_grid_keys': null },
|
||||
{ 'next_panel_keys': null },
|
||||
{ 'previous_panel_keys': null }
|
||||
{ 'previous_panel_keys': null },
|
||||
]
|
||||
);
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,12 +16,12 @@ describe('debuggerUtils', function () {
|
||||
let tab_key = {
|
||||
which: 9,
|
||||
keyCode: 9,
|
||||
}
|
||||
};
|
||||
|
||||
let enter_key = {
|
||||
which: 13,
|
||||
keyCode: 13,
|
||||
}
|
||||
};
|
||||
|
||||
describe('debuggerUtils', function () {
|
||||
it('returns undefined if no command is passed', function () {
|
||||
@@ -31,7 +31,7 @@ describe('debuggerUtils', function () {
|
||||
|
||||
describe('debuggerUtils', function () {
|
||||
it('should call focus on editor', function () {
|
||||
setFocusToDebuggerEditor(editor, enter_key)
|
||||
setFocusToDebuggerEditor(editor, enter_key);
|
||||
expect(editor.focus).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,11 +10,11 @@ import dialogTabNavigator from 'sources/dialog_tab_navigator';
|
||||
import $ from 'jquery';
|
||||
import 'bootstrap';
|
||||
|
||||
describe('dialogTabNavigator', function () {
|
||||
let dialog, tabNavigator, backward_shortcut, forward_shortcut;
|
||||
describe('dialogTabNavigator', function () {
|
||||
let dialog, tabNavigator, backward_shortcut, forward_shortcut;
|
||||
|
||||
beforeEach(() => {
|
||||
let dialogHtml =$('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
||||
beforeEach(() => {
|
||||
let dialogHtml =$('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
||||
' <ul class="nav nav-tabs" role="tablist">'+
|
||||
' <li role="presentation" class="active">'+
|
||||
' <a data-toggle="tab" tabindex="-1" data-tab-index="1" href="#1" aria-controls="1"> General</a>'+
|
||||
@@ -52,64 +52,64 @@ import 'bootstrap';
|
||||
' </ul>'+
|
||||
'</div>');
|
||||
|
||||
dialog = {};
|
||||
dialog = {};
|
||||
|
||||
dialog.el = dialogHtml[0];
|
||||
dialog.$el = dialogHtml;
|
||||
dialog.el = dialogHtml[0];
|
||||
dialog.$el = dialogHtml;
|
||||
|
||||
backward_shortcut = {
|
||||
'alt': false,
|
||||
'shift': true,
|
||||
'control': true,
|
||||
'key': {'key_code': 91, 'char': '['}
|
||||
};
|
||||
backward_shortcut = {
|
||||
'alt': false,
|
||||
'shift': true,
|
||||
'control': true,
|
||||
'key': {'key_code': 91, 'char': '['},
|
||||
};
|
||||
|
||||
forward_shortcut = {
|
||||
'alt': false,
|
||||
'shift': true,
|
||||
'control': true,
|
||||
'key': {'key_code': 93, 'char': ']'}
|
||||
};
|
||||
forward_shortcut = {
|
||||
'alt': false,
|
||||
'shift': true,
|
||||
'control': true,
|
||||
'key': {'key_code': 93, 'char': ']'},
|
||||
};
|
||||
|
||||
tabNavigator = new dialogTabNavigator.dialogTabNavigator(
|
||||
tabNavigator = new dialogTabNavigator.dialogTabNavigator(
|
||||
dialog, backward_shortcut, forward_shortcut);
|
||||
});
|
||||
|
||||
describe('navigate', function () {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
||||
|
||||
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
||||
});
|
||||
|
||||
describe('navigate', function () {
|
||||
it('navigate backward', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+[');
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
||||
expect(tabNavigator.navigateBackward).toHaveBeenCalled();
|
||||
|
||||
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
||||
});
|
||||
|
||||
it('navigate backward', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+[');
|
||||
|
||||
expect(tabNavigator.navigateBackward).toHaveBeenCalled();
|
||||
|
||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
it('navigate forward', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+]');
|
||||
|
||||
expect(tabNavigator.navigateForward).toHaveBeenCalled();
|
||||
|
||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
it('should not navigate', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+a');
|
||||
|
||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||
|
||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
it('navigate forward', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+]');
|
||||
|
||||
expect(tabNavigator.navigateForward).toHaveBeenCalled();
|
||||
|
||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
it('should not navigate', function () {
|
||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+a');
|
||||
|
||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||
|
||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -11,6 +11,6 @@ define(function () {
|
||||
return {
|
||||
'static': '/base/pgadmin/static/<path:filename>',
|
||||
'sqleditor.poll': '/sqleditor/query_tool/poll/<path:trans_id>',
|
||||
'sqleditor.query_tool_start': '/sqleditor/query_tool/start/<path:trans_id>'
|
||||
'sqleditor.query_tool_start': '/sqleditor/query_tool/start/<path:trans_id>',
|
||||
};
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import {nodeHasStatistics} from "../../../../pgadmin/static/js/misc/statistics/statistics";
|
||||
import {nodeHasStatistics} from '../../../../pgadmin/static/js/misc/statistics/statistics';
|
||||
|
||||
describe('#nodeHasStatistics', () => {
|
||||
describe('when node hasStatistics is not a function', () => {
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('#calculateQueryRunTime', () => {
|
||||
minutes:30,
|
||||
seconds:21,
|
||||
milliseconds:70}).toDate();
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
.toEqual('947 msec');
|
||||
});
|
||||
});
|
||||
@@ -52,7 +52,7 @@ describe('#calculateQueryRunTime', () => {
|
||||
minutes:31,
|
||||
seconds:15,
|
||||
milliseconds:70}).toDate();
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
.toEqual('54 secs 947 msec');
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,7 @@ describe('#calculateQueryRunTime', () => {
|
||||
minutes:40,
|
||||
seconds:15,
|
||||
milliseconds:70}).toDate();
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
expect(calculateQueryRunTime(startDate, endDate))
|
||||
.toEqual('9 min 54 secs');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,18 +7,17 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
import filterDialog from 'sources/sqleditor/filter_dialog';
|
||||
import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
|
||||
// import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
|
||||
|
||||
describe('filterDialog', () => {
|
||||
let sqlEditorController;
|
||||
sqlEditorController = jasmine.createSpy('sqlEditorController')
|
||||
jasmine.createSpy('sqlEditorController');
|
||||
describe('filterDialog', () => {
|
||||
describe('when using filter dialog', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(filterDialog, 'dialog');
|
||||
});
|
||||
|
||||
it("it should be defined as function", function() {
|
||||
it('it should be defined as function', function() {
|
||||
expect(filterDialog.dialog).toBeDefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -35,48 +35,48 @@ describe('the keyboard shortcuts', () => {
|
||||
shift: false,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: F5_KEY
|
||||
}
|
||||
key_code: F5_KEY,
|
||||
},
|
||||
},
|
||||
explain: {
|
||||
alt: false,
|
||||
shift: false,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: F7_KEY
|
||||
}
|
||||
key_code: F7_KEY,
|
||||
},
|
||||
},
|
||||
explain_analyze: {
|
||||
alt: false,
|
||||
shift: true,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: F7_KEY
|
||||
}
|
||||
key_code: F7_KEY,
|
||||
},
|
||||
},
|
||||
download_csv: {
|
||||
alt: false,
|
||||
shift: false,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: F8_KEY
|
||||
}
|
||||
key_code: F8_KEY,
|
||||
},
|
||||
},
|
||||
move_next: {
|
||||
alt: false,
|
||||
shift: false,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: null
|
||||
}
|
||||
key_code: null,
|
||||
},
|
||||
},
|
||||
move_previous: {
|
||||
alt: false,
|
||||
shift: false,
|
||||
control: false,
|
||||
key: {
|
||||
key_code: null
|
||||
}
|
||||
key_code: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import {
|
||||
httpResponseRequiresNewTransaction,
|
||||
handleQueryToolAjaxError
|
||||
handleQueryToolAjaxError,
|
||||
} from '../../../pgadmin/static/js/sqleditor/query_tool_http_error_handler';
|
||||
|
||||
describe('#httpResponseRequiresNewTransaction', () => {
|
||||
@@ -71,29 +71,29 @@ describe('#httpResponseRequiresNewTransaction', () => {
|
||||
describe('#handleQueryToolAjaxError', () => {
|
||||
let sqlEditorHandler,
|
||||
exceptionSpy, stateToSave,
|
||||
stateParameters, checkTransaction, UserManagementMock,
|
||||
stateParameters, checkTransaction,
|
||||
pgBrowserMock;
|
||||
|
||||
beforeEach(() => {
|
||||
stateToSave = 'testState';
|
||||
stateParameters = [];
|
||||
checkTransaction = false;
|
||||
sqlEditorHandler = jasmine.createSpyObj(
|
||||
beforeEach(() => {
|
||||
stateToSave = 'testState';
|
||||
stateParameters = [];
|
||||
checkTransaction = false;
|
||||
sqlEditorHandler = jasmine.createSpyObj(
|
||||
'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
|
||||
);
|
||||
exceptionSpy = {
|
||||
readyState: 0,
|
||||
status: 404,
|
||||
data: {
|
||||
info: 'CONNECTION_LOST',
|
||||
},
|
||||
};
|
||||
pgBrowserMock = {
|
||||
'Browser': {
|
||||
'UserManagement': jasmine.createSpyObj('UserManagement', ['isPgaLoginRequired', 'pgaLogin'])
|
||||
}
|
||||
};
|
||||
});
|
||||
exceptionSpy = {
|
||||
readyState: 0,
|
||||
status: 404,
|
||||
data: {
|
||||
info: 'CONNECTION_LOST',
|
||||
},
|
||||
};
|
||||
pgBrowserMock = {
|
||||
'Browser': {
|
||||
'UserManagement': jasmine.createSpyObj('UserManagement', ['isPgaLoginRequired', 'pgaLogin']),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
describe('when ready state is 0', () => {
|
||||
it('should return connection', () => {
|
||||
@@ -149,7 +149,7 @@ describe('#handleQueryToolAjaxError', () => {
|
||||
exceptionSpy.readyState = 1;
|
||||
exceptionSpy.status = 503;
|
||||
exceptionSpy.responseJSON = {
|
||||
'info': 'CONNECTION_LOST'
|
||||
'info': 'CONNECTION_LOST',
|
||||
};
|
||||
pgBrowserMock.Browser.UserManagement.isPgaLoginRequired.and.returnValue(false);
|
||||
checkTransaction = false;
|
||||
|
||||
Reference in New Issue
Block a user