blob: cdb5c9ab86266201e144ef87f3862285b8d325a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
});
});
|