blob: c3a7946c85c84c1591c6efb2269fd69baf88155d (
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
36
|
import { nextTick } from 'vue';
import { mount } from '@vue/test-utils';
import DraftsCount from '~/batch_comments/components/drafts_count.vue';
import { createStore } from '~/batch_comments/stores';
describe('Batch comments drafts count component', () => {
let store;
let wrapper;
beforeEach(() => {
store = createStore();
store.state.batchComments.drafts.push('comment');
wrapper = mount(DraftsCount, { store });
});
afterEach(() => {
wrapper.destroy();
});
it('renders count', () => {
expect(wrapper.text()).toContain('1');
});
it('renders screen reader text', async () => {
const el = wrapper.find('.sr-only');
expect(el.text()).toContain('draft');
store.state.batchComments.drafts.push('comment 2');
await nextTick();
expect(el.text()).toContain('drafts');
});
});
|