diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-21 16:19:08 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-21 16:19:08 +0300 |
commit | b8a96fda9c2a36aab6af603bf376fc97c19c2bca (patch) | |
tree | d505e87b0b3928e6533ca9d77ace51d16f56a97f /spec/javascripts/shortcuts_spec.js | |
parent | f09f753908a001e791a254d277032734f6fe57b6 (diff) |
Fixed the preview keyboard shortcut focusing wrong tab
Closes #31101
Diffstat (limited to 'spec/javascripts/shortcuts_spec.js')
-rw-r--r-- | spec/javascripts/shortcuts_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/javascripts/shortcuts_spec.js b/spec/javascripts/shortcuts_spec.js new file mode 100644 index 00000000000..9dd7bc5b42c --- /dev/null +++ b/spec/javascripts/shortcuts_spec.js @@ -0,0 +1,29 @@ +/* global Shortcuts */ +describe('Shortcuts', () => { + const fixtureName = 'issues/open-issue.html.raw'; + + preloadFixtures(fixtureName); + + describe('toggleMarkdownPreview', () => { + let sc; + let event; + + beforeEach(() => { + loadFixtures(fixtureName); + + spyOnEvent('.js-md-preview-button', 'focus'); + + event = $.Event('', { + target: document.querySelector('.js-note-text'), + }); + + sc = new Shortcuts(); + }); + + it('focuses preview button in form', () => { + sc.toggleMarkdownPreview(event); + + expect('focus').toHaveBeenTriggeredOn('.js-md-preview-button'); + }); + }); +}); |