summaryrefslogtreecommitdiff
path: root/spec/frontend/content_editor/components/content_editor_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/content_editor/components/content_editor_spec.js')
-rw-r--r--spec/frontend/content_editor/components/content_editor_spec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/frontend/content_editor/components/content_editor_spec.js b/spec/frontend/content_editor/components/content_editor_spec.js
new file mode 100644
index 00000000000..f055a49135b
--- /dev/null
+++ b/spec/frontend/content_editor/components/content_editor_spec.js
@@ -0,0 +1,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);
+ });
+});