blob: 2489421b697194d458c4f12f18e9f2cb22dbea68 (
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
37
38
39
40
41
42
43
44
45
46
|
import { mount } from '@vue/test-utils';
import Toolbar from '~/vue_shared/components/markdown/toolbar.vue';
describe('toolbar', () => {
let wrapper;
const createMountedWrapper = (props = {}) => {
wrapper = mount(Toolbar, {
propsData: { markdownDocsPath: '', ...props },
});
};
describe('user can attach file', () => {
beforeEach(() => {
createMountedWrapper();
});
it('should render uploading-container', () => {
expect(wrapper.vm.$el.querySelector('.uploading-container')).not.toBeNull();
});
});
describe('user cannot attach file', () => {
beforeEach(() => {
createMountedWrapper({ canAttachFile: false });
});
it('should not render uploading-container', () => {
expect(wrapper.vm.$el.querySelector('.uploading-container')).toBeNull();
});
});
describe('comment tool bar settings', () => {
it('does not show comment tool bar div', () => {
createMountedWrapper({ showCommentToolBar: false });
expect(wrapper.find('.comment-toolbar').exists()).toBe(false);
});
it('shows comment tool bar by default', () => {
createMountedWrapper();
expect(wrapper.find('.comment-toolbar').exists()).toBe(true);
});
});
});
|