blob: a9201b786698c9ce0f05db69fc1094653fbe4f28 (
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
35
|
import { shallowMount } from '@vue/test-utils';
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
const placeholderText = 'Test Button Text';
describe('ReplyPlaceholder', () => {
let wrapper;
const createComponent = ({ options = {} } = {}) => {
wrapper = shallowMount(ReplyPlaceholder, {
propsData: {
placeholderText,
},
...options,
});
};
const findTextarea = () => wrapper.findComponent({ ref: 'textarea' });
it('emits focus event on button click', async () => {
createComponent({ options: { attachTo: document.body } });
await findTextarea().trigger('focus');
expect(wrapper.emitted()).toEqual({
focus: [[]],
});
});
it('should render reply button', () => {
createComponent();
expect(findTextarea().attributes('placeholder')).toEqual(placeholderText);
});
});
|