diff options
Diffstat (limited to 'spec/frontend/shortcuts_spec.js')
-rw-r--r-- | spec/frontend/shortcuts_spec.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/frontend/shortcuts_spec.js b/spec/frontend/shortcuts_spec.js index e859d435f48..d1371ca0ef9 100644 --- a/spec/frontend/shortcuts_spec.js +++ b/spec/frontend/shortcuts_spec.js @@ -119,10 +119,21 @@ describe('Shortcuts', () => { }); describe('focusSearch', () => { - it('focuses the search bar', () => { - Shortcuts.focusSearch(createEvent('KeyboardEvent')); + describe('when super sidebar is NOT enabled', () => { + let originalGon; + beforeEach(() => { + originalGon = window.gon; + window.gon = { use_new_navigation: false }; + }); - expect(document.querySelector('#search').focus).toHaveBeenCalled(); + afterEach(() => { + window.gon = originalGon; + }); + + it('focuses the search bar', () => { + Shortcuts.focusSearch(createEvent('KeyboardEvent')); + expect(document.querySelector('#search').focus).toHaveBeenCalled(); + }); }); }); }); |