diff options
Diffstat (limited to 'spec/frontend/pipelines/graph')
-rw-r--r-- | spec/frontend/pipelines/graph/action_component_spec.js | 3 | ||||
-rw-r--r-- | spec/frontend/pipelines/graph/graph_component_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/pipelines/graph/linked_pipeline_spec.js | 20 |
3 files changed, 12 insertions, 13 deletions
diff --git a/spec/frontend/pipelines/graph/action_component_spec.js b/spec/frontend/pipelines/graph/action_component_spec.js index 3c5938cfa1f..ab477292bc1 100644 --- a/spec/frontend/pipelines/graph/action_component_spec.js +++ b/spec/frontend/pipelines/graph/action_component_spec.js @@ -1,4 +1,5 @@ import { mount } from '@vue/test-utils'; +import { GlButton } from '@gitlab/ui'; import MockAdapter from 'axios-mock-adapter'; import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; @@ -7,7 +8,7 @@ import ActionComponent from '~/pipelines/components/graph/action_component.vue'; describe('pipeline graph action component', () => { let wrapper; let mock; - const findButton = () => wrapper.find('button'); + const findButton = () => wrapper.find(GlButton); beforeEach(() => { mock = new MockAdapter(axios); diff --git a/spec/frontend/pipelines/graph/graph_component_spec.js b/spec/frontend/pipelines/graph/graph_component_spec.js index 9731ce3f8a6..1389649abea 100644 --- a/spec/frontend/pipelines/graph/graph_component_spec.js +++ b/spec/frontend/pipelines/graph/graph_component_spec.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import { mount } from '@vue/test-utils'; +import { setHTMLFixture } from 'helpers/fixtures'; import PipelineStore from '~/pipelines/stores/pipeline_store'; import graphComponent from '~/pipelines/components/graph/graph_component.vue'; import stageColumnComponent from '~/pipelines/components/graph/stage_column_component.vue'; @@ -7,7 +8,6 @@ import linkedPipelinesColumn from '~/pipelines/components/graph/linked_pipelines import graphJSON from './mock_data'; import linkedPipelineJSON from './linked_pipelines_mock_data'; import PipelinesMediator from '~/pipelines/pipeline_details_mediator'; -import { setHTMLFixture } from 'helpers/fixtures'; describe('graph component', () => { const store = new PipelineStore(); diff --git a/spec/frontend/pipelines/graph/linked_pipeline_spec.js b/spec/frontend/pipelines/graph/linked_pipeline_spec.js index 133d5695afb..59121c54ff3 100644 --- a/spec/frontend/pipelines/graph/linked_pipeline_spec.js +++ b/spec/frontend/pipelines/graph/linked_pipeline_spec.js @@ -1,4 +1,5 @@ import { mount } from '@vue/test-utils'; +import { GlButton } from '@gitlab/ui'; import LinkedPipelineComponent from '~/pipelines/components/graph/linked_pipeline.vue'; import CiStatus from '~/vue_shared/components/ci_icon.vue'; @@ -12,7 +13,7 @@ const invalidTriggeredPipelineId = mockPipeline.project.id + 5; describe('Linked pipeline', () => { let wrapper; - const findButton = () => wrapper.find('button'); + const findButton = () => wrapper.find(GlButton); const findPipelineLabel = () => wrapper.find('[data-testid="downstream-pipeline-label"]'); const findLinkedPipeline = () => wrapper.find({ ref: 'linkedPipeline' }); @@ -42,9 +43,7 @@ describe('Linked pipeline', () => { }); it('should render a button', () => { - const linkElement = wrapper.find('.js-linked-pipeline-content'); - - expect(linkElement.exists()).toBe(true); + expect(findButton().exists()).toBe(true); }); it('should render the project name', () => { @@ -62,7 +61,7 @@ describe('Linked pipeline', () => { }); it('should have a ci-status child component', () => { - expect(wrapper.find('.js-linked-pipeline-status').exists()).toBe(true); + expect(wrapper.find(CiStatus).exists()).toBe(true); }); it('should render the pipeline id', () => { @@ -77,15 +76,14 @@ describe('Linked pipeline', () => { }); it('should render the tooltip text as the title attribute', () => { - const tooltipRef = wrapper.find('.js-linked-pipeline-content'); - const titleAttr = tooltipRef.attributes('title'); + const titleAttr = findButton().attributes('title'); expect(titleAttr).toContain(mockPipeline.project.name); expect(titleAttr).toContain(mockPipeline.details.status.label); }); - it('does not render the loading icon when isLoading is false', () => { - expect(wrapper.find('.js-linked-pipeline-loading').exists()).toBe(false); + it('sets the loading prop to false', () => { + expect(findButton().props('loading')).toBe(false); }); it('should display multi-project label when pipeline project id is not the same as triggered pipeline project id', () => { @@ -132,8 +130,8 @@ describe('Linked pipeline', () => { createWrapper(props); }); - it('renders a loading icon', () => { - expect(wrapper.find('.js-linked-pipeline-loading').exists()).toBe(true); + it('sets the loading prop to true', () => { + expect(findButton().props('loading')).toBe(true); }); }); |