2021-04-29 21:17:54 +05:30
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
import Toolbar from '~/vue_shared/components/markdown/toolbar.vue';
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe('toolbar', () => {
|
2021-04-29 21:17:54 +05:30
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const createMountedWrapper = (props = {}) => {
|
|
|
|
wrapper = mount(Toolbar, {
|
|
|
|
propsData: { markdownDocsPath: '', ...props },
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
afterEach(() => {
|
2021-04-29 21:17:54 +05:30
|
|
|
wrapper.destroy();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('user can attach file', () => {
|
|
|
|
beforeEach(() => {
|
2021-04-29 21:17:54 +05:30
|
|
|
createMountedWrapper();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should render uploading-container', () => {
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(wrapper.vm.$el.querySelector('.uploading-container')).not.toBeNull();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('user cannot attach file', () => {
|
|
|
|
beforeEach(() => {
|
2021-04-29 21:17:54 +05:30
|
|
|
createMountedWrapper({ canAttachFile: false });
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should not render uploading-container', () => {
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(wrapper.vm.$el.querySelector('.uploading-container')).toBeNull();
|
|
|
|
});
|
|
|
|
});
|
2022-07-16 23:28:13 +05:30
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|