diff options
Diffstat (limited to 'spec/frontend/pipeline_editor/components/drawer')
6 files changed, 0 insertions, 255 deletions
diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js b/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js deleted file mode 100644 index 7e1e5004d91..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js +++ /dev/null @@ -1,60 +0,0 @@ -import { getByRole } from '@testing-library/dom'; -import { mount } from '@vue/test-utils'; -import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue'; -import { pipelineEditorTrackingOptions } from '~/pipeline_editor/constants'; - -describe('First pipeline card', () => { - let wrapper; - let trackingSpy; - - const createComponent = () => { - wrapper = mount(FirstPipelineCard); - }; - - const getLinkByName = (name) => getByRole(wrapper.element, 'link', { name }); - const findRunnersLink = () => getLinkByName(/make sure your instance has runners available/i); - const findInstructionsList = () => wrapper.find('ol'); - const findAllInstructions = () => findInstructionsList().findAll('li'); - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the title', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title); - }); - - it('renders the content', () => { - expect(findInstructionsList().exists()).toBe(true); - expect(findAllInstructions()).toHaveLength(3); - }); - - it('renders the link', () => { - expect(findRunnersLink().href).toBe(wrapper.vm.$options.RUNNER_HELP_URL); - }); - - describe('tracking', () => { - beforeEach(() => { - createComponent(); - trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn); - }); - - afterEach(() => { - unmockTracking(); - }); - - it('tracks runners help page click', async () => { - const { label } = pipelineEditorTrackingOptions; - const { runners } = pipelineEditorTrackingOptions.actions.helpDrawerLinks; - - await findRunnersLink().click(); - - expect(trackingSpy).toHaveBeenCalledWith(undefined, runners, { label }); - }); - }); -}); diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/getting_started_card_spec.js b/spec/frontend/pipeline_editor/components/drawer/cards/getting_started_card_spec.js deleted file mode 100644 index c592e959068..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/cards/getting_started_card_spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import GettingStartedCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue'; - -describe('Getting started card', () => { - let wrapper; - - const createComponent = () => { - wrapper = shallowMount(GettingStartedCard); - }; - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the title', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title); - }); - - it('renders the content', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.firstParagraph); - }); -}); diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js b/spec/frontend/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js deleted file mode 100644 index 49177befe0e..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js +++ /dev/null @@ -1,89 +0,0 @@ -import { getByRole } from '@testing-library/dom'; -import { mount } from '@vue/test-utils'; -import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import PipelineConfigReferenceCard from '~/pipeline_editor/components/drawer/cards/pipeline_config_reference_card.vue'; -import { pipelineEditorTrackingOptions } from '~/pipeline_editor/constants'; - -describe('Pipeline config reference card', () => { - let wrapper; - let trackingSpy; - - const defaultProvide = { - ciExamplesHelpPagePath: 'help/ci/examples/', - ciHelpPagePath: 'help/ci/introduction', - needsHelpPagePath: 'help/ci/yaml#needs', - ymlHelpPagePath: 'help/ci/yaml', - }; - - const createComponent = () => { - wrapper = mount(PipelineConfigReferenceCard, { - provide: { - ...defaultProvide, - }, - }); - }; - - const getLinkByName = (name) => getByRole(wrapper.element, 'link', { name }); - const findCiExamplesLink = () => getLinkByName(/CI\/CD examples and templates/i); - const findCiIntroLink = () => getLinkByName(/GitLab CI\/CD concepts/i); - const findNeedsLink = () => getLinkByName(/Needs keyword/i); - const findYmlSyntaxLink = () => getLinkByName(/.gitlab-ci.yml syntax reference/i); - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the title', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title); - }); - - it('renders the content', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.firstParagraph); - }); - - it('renders the links', () => { - expect(findCiExamplesLink().href).toContain(defaultProvide.ciExamplesHelpPagePath); - expect(findCiIntroLink().href).toContain(defaultProvide.ciHelpPagePath); - expect(findNeedsLink().href).toContain(defaultProvide.needsHelpPagePath); - expect(findYmlSyntaxLink().href).toContain(defaultProvide.ymlHelpPagePath); - }); - - describe('tracking', () => { - beforeEach(() => { - createComponent(); - trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn); - }); - - afterEach(() => { - unmockTracking(); - }); - - const testTracker = async (element, expectedAction) => { - const { label } = pipelineEditorTrackingOptions; - - await element.click(); - - expect(trackingSpy).toHaveBeenCalledWith(undefined, expectedAction, { - label, - }); - }; - - it('tracks help page links', async () => { - const { - CI_EXAMPLES_LINK, - CI_HELP_LINK, - CI_NEEDS_LINK, - CI_YAML_LINK, - } = pipelineEditorTrackingOptions.actions.helpDrawerLinks; - - testTracker(findCiExamplesLink(), CI_EXAMPLES_LINK); - testTracker(findCiIntroLink(), CI_HELP_LINK); - testTracker(findNeedsLink(), CI_NEEDS_LINK); - testTracker(findYmlSyntaxLink(), CI_YAML_LINK); - }); - }); -}); diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js b/spec/frontend/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js deleted file mode 100644 index bebd2484c1d..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import VisualizeAndLintCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue'; - -describe('Visual and Lint card', () => { - let wrapper; - - const createComponent = () => { - wrapper = shallowMount(VisualizeAndLintCard); - }; - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the title', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title); - }); - - it('renders the content', () => { - expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.firstParagraph); - }); -}); diff --git a/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js b/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js deleted file mode 100644 index 33b53bf6a56..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import { GlDrawer } from '@gitlab/ui'; -import PipelineEditorDrawer from '~/pipeline_editor/components/drawer/pipeline_editor_drawer.vue'; - -describe('Pipeline editor drawer', () => { - let wrapper; - - const findDrawer = () => wrapper.findComponent(GlDrawer); - - const createComponent = () => { - wrapper = shallowMount(PipelineEditorDrawer); - }; - - afterEach(() => { - wrapper.destroy(); - }); - - it('emits close event when closing the drawer', () => { - createComponent(); - - expect(wrapper.emitted('close-drawer')).toBeUndefined(); - - findDrawer().vm.$emit('close'); - - expect(wrapper.emitted('close-drawer')).toHaveLength(1); - }); -}); diff --git a/spec/frontend/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js b/spec/frontend/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js deleted file mode 100644 index edd2b45569a..00000000000 --- a/spec/frontend/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import DemoJobPill from '~/pipeline_editor/components/drawer/ui/demo_job_pill.vue'; - -describe('Demo job pill', () => { - let wrapper; - const jobName = 'my-build-job'; - - const createComponent = () => { - wrapper = shallowMount(DemoJobPill, { - propsData: { - jobName, - }, - }); - }; - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the jobName', () => { - expect(wrapper.text()).toContain(jobName); - }); -}); |