diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-17 14:35:02 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-17 14:35:02 +0100 |
commit | 292780272e41740102eca2630a681887d137e67e (patch) | |
tree | 379829914a37fac23fc87c3b734f488fe656cbb1 /spec | |
parent | 4fcff0bfa2f0d8b0a9f60e93bee807334557918f (diff) | |
download | gitlab-ce-292780272e41740102eca2630a681887d137e67e.tar.gz |
Focus the description field in the inline form when mounted
[ci skip]
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..6ea52feb84f --- /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 text 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); + }); +}); |