Fixup tests following label changes.

This commit is contained in:
Murtuza Zabuawala
2017-07-26 13:45:44 +01:00
committed by Dave Page
parent 97cd74a373
commit af26d983e5

View File

@@ -14,9 +14,9 @@ describe('the keyboard shortcuts', () => {
F5_KEY = 116, F5_KEY = 116,
F7_KEY = 118, F7_KEY = 118,
F8_KEY = 119, F8_KEY = 119,
COMMA_KEY = 188,
PERIOD_KEY = 190, PERIOD_KEY = 190,
FWD_SLASH_KEY = 191; FWD_SLASH_KEY = 191,
isMacSystem = window.navigator.platform.search('Mac') != -1;
let sqlEditorControllerSpy; let sqlEditorControllerSpy;
let event; let event;
@@ -164,12 +164,13 @@ describe('the keyboard shortcuts', () => {
}); });
}); });
describe('Shift+CTRL+Comma', () => { describe('inlineComment', () => {
describe('when there is not a query already running', () => { describe('when there is not a query already running', () => {
beforeEach(() => { beforeEach(() => {
event.metaKey = isMacSystem;
event.shiftKey = true; event.shiftKey = true;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = COMMA_KEY; event.which = FWD_SLASH_KEY;
keyboardShortcuts.processEvent(sqlEditorControllerSpy, event); keyboardShortcuts.processEvent(sqlEditorControllerSpy, event);
}); });
@@ -182,9 +183,9 @@ describe('the keyboard shortcuts', () => {
describe('when the query is already running', () => { describe('when the query is already running', () => {
it('does nothing', () => { it('does nothing', () => {
event.shiftKey = true; event.shiftKey = isMacSystem;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = COMMA_KEY; event.which = FWD_SLASH_KEY;
sqlEditorControllerSpy.isQueryRunning.and.returnValue(true); sqlEditorControllerSpy.isQueryRunning.and.returnValue(true);
keyboardShortcuts.processEvent(sqlEditorControllerSpy, event); keyboardShortcuts.processEvent(sqlEditorControllerSpy, event);
@@ -194,11 +195,12 @@ describe('the keyboard shortcuts', () => {
}); });
}); });
describe('Shift+CTRL+Period', () => { describe('inlineUncomment', () => {
describe('when there is not a query already running', () => { describe('when there is not a query already running', () => {
beforeEach(() => { beforeEach(() => {
event.metaKey = isMacSystem;
event.shiftKey = true; event.shiftKey = true;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = PERIOD_KEY; event.which = PERIOD_KEY;
keyboardShortcuts.processEvent(sqlEditorControllerSpy, event); keyboardShortcuts.processEvent(sqlEditorControllerSpy, event);
}); });
@@ -212,9 +214,10 @@ describe('the keyboard shortcuts', () => {
describe('when the query is already running', () => { describe('when the query is already running', () => {
it('does nothing', () => { it('does nothing', () => {
event.metaKey = isMacSystem;
event.shiftKey = true; event.shiftKey = true;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = COMMA_KEY; event.which = PERIOD_KEY;
sqlEditorControllerSpy.isQueryRunning.and.returnValue(true); sqlEditorControllerSpy.isQueryRunning.and.returnValue(true);
keyboardShortcuts.processEvent(sqlEditorControllerSpy, event); keyboardShortcuts.processEvent(sqlEditorControllerSpy, event);
@@ -224,11 +227,11 @@ describe('the keyboard shortcuts', () => {
}); });
}); });
describe('Shift+CTRL+/', () => { describe('blockComment', () => {
describe('when there is not a query already running', () => { describe('when there is not a query already running', () => {
beforeEach(() => { beforeEach(() => {
event.shiftKey = true; event.metaKey = isMacSystem;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = FWD_SLASH_KEY; event.which = FWD_SLASH_KEY;
keyboardShortcuts.processEvent(sqlEditorControllerSpy, event); keyboardShortcuts.processEvent(sqlEditorControllerSpy, event);
}); });
@@ -242,8 +245,8 @@ describe('the keyboard shortcuts', () => {
describe('when the query is already running', () => { describe('when the query is already running', () => {
it('does nothing', () => { it('does nothing', () => {
event.shiftKey = true; event.metaKey = isMacSystem;
event.ctrlKey = true; event.ctrlKey = !isMacSystem;
event.which = FWD_SLASH_KEY; event.which = FWD_SLASH_KEY;
sqlEditorControllerSpy.isQueryRunning.and.returnValue(true); sqlEditorControllerSpy.isQueryRunning.and.returnValue(true);