2018-01-23 05:58:10 -06:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2023-01-02 00:23:55 -06:00
|
|
|
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
2018-01-23 05:58:10 -06:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-03-14 10:11:16 -05:00
|
|
|
import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
|
2019-06-10 05:10:49 -05:00
|
|
|
import $ from 'jquery';
|
2018-01-23 05:58:10 -06:00
|
|
|
|
|
|
|
describe('the keyboard shortcuts', () => {
|
|
|
|
describe('when user wants to goto next panel', function () {
|
2019-06-10 05:10:49 -05:00
|
|
|
let dockerSpy = {
|
|
|
|
'_focusFrame': {
|
|
|
|
'_curTab': 0,
|
|
|
|
'_panelList': [
|
|
|
|
{$container: $('<b/>'), '_type': 'type1', 'focus': function() {return true;}},
|
|
|
|
{$container: $('<b/>'), '_type': 'type2', 'focus': function() {return true;}},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
it('right key', function () {
|
|
|
|
dockerSpy._focusFrame._curTab = 0;
|
|
|
|
expect(keyboardShortcuts.focusDockerPanel(dockerSpy, 'right')).toEqual('type2');
|
|
|
|
});
|
|
|
|
it('left key', function () {
|
|
|
|
dockerSpy._focusFrame._curTab = 1;
|
|
|
|
expect(keyboardShortcuts.focusDockerPanel(dockerSpy, 'left')).toEqual('type1');
|
|
|
|
});
|
|
|
|
it('left key cycle', function () {
|
|
|
|
dockerSpy._focusFrame._curTab = 0;
|
|
|
|
expect(keyboardShortcuts.focusDockerPanel(dockerSpy, 'left')).toEqual('type2');
|
|
|
|
});
|
|
|
|
it('right key cycle', function () {
|
|
|
|
dockerSpy._focusFrame._curTab = 1;
|
|
|
|
expect(keyboardShortcuts.focusDockerPanel(dockerSpy, 'left')).toEqual('type1');
|
2018-01-23 05:58:10 -06:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|