Commit 29278027 authored by Phil Hughes's avatar Phil Hughes

Focus the description field in the inline form when mounted

[ci skip]
parent 4fcff0bf
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
components: { components: {
markdownField, markdownField,
}, },
mounted() {
this.$refs.textarea.focus();
},
}; };
</script> </script>
...@@ -39,7 +42,7 @@ ...@@ -39,7 +42,7 @@
data-supports-slash-commands="false" data-supports-slash-commands="false"
aria-label="Description" aria-label="Description"
v-model="formState.description" v-model="formState.description"
ref="textatea" ref="textarea"
slot="textarea"> slot="textarea">
</textarea> </textarea>
</markdown-field> </markdown-field>
......
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);
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment