Skip to content
Snippets Groups Projects
Commit f5675666 authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

Merge branch 'auto-focus-description-field' into 'issue-edit-inline'

Focus the description field in the inline form when mounted

See merge request !11441
parents 16288e78 9c9a24ce
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -20,6 +20,9 @@
components: {
markdownField,
},
mounted() {
this.$refs.textarea.focus();
},
};
</script>
 
Loading
Loading
@@ -39,7 +42,7 @@
data-supports-slash-commands="false"
aria-label="Description"
v-model="formState.description"
ref="textatea"
ref="textarea"
slot="textarea">
</textarea>
</markdown-field>
Loading
Loading
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);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment