Fix keyboard navigation in "inner" tabsets such as the Query Tool and Debugger. Fixes #4195

This commit is contained in:
Aditya Toshniwal
2019-06-10 11:10:49 +01:00
committed by Dave Page
parent 321b445a7e
commit f561c0cee6
11 changed files with 227 additions and 95 deletions

View File

@@ -8,6 +8,7 @@
//////////////////////////////////////////////////////////////////////////
import * as keyboardShortcuts from 'sources/keyboard_shortcuts';
import $ from 'jquery';
describe('the keyboard shortcuts', () => {
const F1_KEY = 112;
@@ -45,9 +46,30 @@ describe('the keyboard shortcuts', () => {
});
describe('when user wants to goto next panel', function () {
it('returns panel id', function () {
expect(keyboardShortcuts.getInnerPanel(debuggerElementSpy, 'right')).toEqual(false);
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');
});
});

View File

@@ -7,7 +7,7 @@
//
//////////////////////////////////////////////////////////////
import { getEpoch, getGCD } from 'sources/utils';
import { getEpoch, getGCD, getMod } from 'sources/utils';
describe('getEpoch', function () {
it('should return non zero', function () {
@@ -33,3 +33,21 @@ describe('getGCD', function () {
expect(getGCD(nos)).toEqual(3);
});
});
describe('getMod', function () {
it('complete divisible', function () {
expect(getMod(5,5)).toEqual(0);
});
it('incomplete divisible less divisor', function () {
expect(getMod(7,5)).toEqual(2);
});
it('incomplete divisible greater divisor', function () {
expect(getMod(5,7)).toEqual(5);
});
it('negative number', function () {
expect(getMod(-7,5)).toEqual(3);
});
});