blob: 850a7efb4ed39c17b5f96b3b4df821546286d521 (
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
|
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 });
});
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');
});
});
|