diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/file_finder/index_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/file_finder/index_spec.js | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/spec/frontend/vue_shared/components/file_finder/index_spec.js b/spec/frontend/vue_shared/components/file_finder/index_spec.js index f9e56774526..40026021777 100644 --- a/spec/frontend/vue_shared/components/file_finder/index_spec.js +++ b/spec/frontend/vue_shared/components/file_finder/index_spec.js @@ -84,7 +84,7 @@ describe('File finder item spec', () => { waitForPromises() .then(() => { - vm.$el.querySelector('.dropdown-input-clear').click(); + vm.clearSearchInput(); }) .then(waitForPromises) .then(() => { @@ -94,13 +94,13 @@ describe('File finder item spec', () => { .catch(done.fail); }); - it('clear button focues search input', done => { + it('clear button focuses search input', done => { jest.spyOn(vm.$refs.searchInput, 'focus').mockImplementation(() => {}); vm.searchText = 'index'; waitForPromises() .then(() => { - vm.$el.querySelector('.dropdown-input-clear').click(); + vm.clearSearchInput(); }) .then(waitForPromises) .then(() => { @@ -319,8 +319,8 @@ describe('File finder item spec', () => { .catch(done.fail); }); - it('calls toggle on `command+p` key press', done => { - Mousetrap.trigger('command+p'); + it('calls toggle on `mod+p` key press', done => { + Mousetrap.trigger('mod+p'); vm.$nextTick() .then(() => { @@ -330,39 +330,28 @@ describe('File finder item spec', () => { .catch(done.fail); }); - it('calls toggle on `ctrl+p` key press', done => { - Mousetrap.trigger('ctrl+p'); - - vm.$nextTick() - .then(() => { - expect(vm.toggle).toHaveBeenCalled(); - }) - .then(done) - .catch(done.fail); - }); - - it('always allows `command+p` to trigger toggle', () => { + it('always allows `mod+p` to trigger toggle', () => { expect( - vm.mousetrapStopCallback(null, vm.$el.querySelector('.dropdown-input-field'), 'command+p'), - ).toBe(false); - }); - - it('always allows `ctrl+p` to trigger toggle', () => { - expect( - vm.mousetrapStopCallback(null, vm.$el.querySelector('.dropdown-input-field'), 'ctrl+p'), + Mousetrap.prototype.stopCallback( + null, + vm.$el.querySelector('.dropdown-input-field'), + 'mod+p', + ), ).toBe(false); }); it('onlys handles `t` when focused in input-field', () => { expect( - vm.mousetrapStopCallback(null, vm.$el.querySelector('.dropdown-input-field'), 't'), + Mousetrap.prototype.stopCallback(null, vm.$el.querySelector('.dropdown-input-field'), 't'), ).toBe(true); }); it('stops callback in monaco editor', () => { setFixtures('<div class="inputarea"></div>'); - expect(vm.mousetrapStopCallback(null, document.querySelector('.inputarea'), 't')).toBe(true); + expect( + Mousetrap.prototype.stopCallback(null, document.querySelector('.inputarea'), 't'), + ).toBe(true); }); }); }); |