diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/frontend/pipeline_editor/components/text_editor_spec.js | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-13.6.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/frontend/pipeline_editor/components/text_editor_spec.js')
-rw-r--r-- | spec/frontend/pipeline_editor/components/text_editor_spec.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_editor/components/text_editor_spec.js b/spec/frontend/pipeline_editor/components/text_editor_spec.js new file mode 100644 index 00000000000..39d205839f4 --- /dev/null +++ b/spec/frontend/pipeline_editor/components/text_editor_spec.js @@ -0,0 +1,41 @@ +import { shallowMount } from '@vue/test-utils'; +import EditorLite from '~/vue_shared/components/editor_lite.vue'; +import { mockCiYml } from '../mock_data'; + +import TextEditor from '~/pipeline_editor/components/text_editor.vue'; + +describe('~/pipeline_editor/components/text_editor.vue', () => { + let wrapper; + + const createComponent = (props = {}, mountFn = shallowMount) => { + wrapper = mountFn(TextEditor, { + propsData: { + value: mockCiYml, + ...props, + }, + }); + }; + + const findEditor = () => wrapper.find(EditorLite); + + it('contains an editor', () => { + createComponent(); + + expect(findEditor().exists()).toBe(true); + }); + + it('editor contains the value provided', () => { + expect(findEditor().props('value')).toBe(mockCiYml); + }); + + it('editor is readony and configured for .yml', () => { + expect(findEditor().props('editorOptions')).toEqual({ readOnly: true }); + expect(findEditor().props('fileName')).toBe('*.yml'); + }); + + it('bubbles up editor-ready event', () => { + findEditor().vm.$emit('editor-ready'); + + expect(wrapper.emitted('editor-ready')).toHaveLength(1); + }); +}); |