debian-mirror-gitlab/spec/frontend/vue_shared/components/markdown/toolbar_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.2 KiB
JavaScript
Raw Normal View History

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
};
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
});