blob: f055a49135bbcb6a8cc1db39a483da38b1891c2b (
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
|
import { shallowMount } from '@vue/test-utils';
import { EditorContent } from 'tiptap';
import ContentEditor from '~/content_editor/components/content_editor.vue';
import createEditor from '~/content_editor/services/create_editor';
jest.mock('~/content_editor/services/create_editor');
describe('ContentEditor', () => {
let wrapper;
const buildWrapper = () => {
wrapper = shallowMount(ContentEditor);
};
afterEach(() => {
wrapper.destroy();
});
it('renders editor content component and attaches editor instance', () => {
const editor = {};
createEditor.mockReturnValueOnce(editor);
buildWrapper();
expect(wrapper.findComponent(EditorContent).props().editor).toBe(editor);
});
});
|