diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-05-18 10:14:06 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-05-18 10:14:06 +0000 |
commit | f5675666a11ff296e27b6dbdf0f789242fcd1b7f (patch) | |
tree | 8d51c95a447e266d5fd0d4b18a032927fec0210c /spec | |
parent | 16288e78568841ceb74fa922b7e0e84496c8808e (diff) | |
parent | 9c9a24cee8d961fa33675b857f2ad980e20e0a4b (diff) | |
download | gitlab-ce-f5675666a11ff296e27b6dbdf0f789242fcd1b7f.tar.gz |
Merge branch 'auto-focus-description-field' into 'issue-edit-inline'
Focus the description field in the inline form when mounted
See merge request !11441
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/issue_show/components/fields/description_spec.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/javascripts/issue_show/components/fields/description_spec.js b/spec/javascripts/issue_show/components/fields/description_spec.js new file mode 100644 index 00000000000..cdb5c9ab862 --- /dev/null +++ b/spec/javascripts/issue_show/components/fields/description_spec.js @@ -0,0 +1,34 @@ +import Vue from 'vue'; +import descriptionField from '~/issue_show/components/fields/description.vue'; + +describe('Description field component', () => { + let vm; + + beforeEach((done) => { + const Component = Vue.extend(descriptionField); + + // Needs an el in the DOM to be able to test the element is focused + const el = document.createElement('div'); + + document.body.appendChild(el); + + vm = new Component({ + el, + propsData: { + formState: { + description: '', + }, + markdownDocs: '/', + markdownPreviewUrl: '/', + }, + }).$mount(); + + Vue.nextTick(done); + }); + + it('focuses field when mounted', () => { + expect( + document.activeElement, + ).toBe(vm.$refs.textarea); + }); +}); |