diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/javascripts/pipelines/graph/stage_column_component_spec.js | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/javascripts/pipelines/graph/stage_column_component_spec.js')
-rw-r--r-- | spec/javascripts/pipelines/graph/stage_column_component_spec.js | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/spec/javascripts/pipelines/graph/stage_column_component_spec.js b/spec/javascripts/pipelines/graph/stage_column_component_spec.js deleted file mode 100644 index dbfeeae43fe..00000000000 --- a/spec/javascripts/pipelines/graph/stage_column_component_spec.js +++ /dev/null @@ -1,122 +0,0 @@ -import Vue from 'vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import stageColumnComponent from '~/pipelines/components/graph/stage_column_component.vue'; - -describe('stage column component', () => { - let component; - const StageColumnComponent = Vue.extend(stageColumnComponent); - - const mockJob = { - id: 4250, - name: 'test', - status: { - icon: 'status_success', - text: 'passed', - label: 'passed', - group: 'success', - details_path: '/root/ci-mock/builds/4250', - action: { - icon: 'retry', - title: 'Retry', - path: '/root/ci-mock/builds/4250/retry', - method: 'post', - }, - }, - }; - - beforeEach(() => { - const mockGroups = []; - for (let i = 0; i < 3; i += 1) { - const mockedJob = Object.assign({}, mockJob); - mockedJob.id += i; - mockGroups.push(mockedJob); - } - - component = mountComponent(StageColumnComponent, { - title: 'foo', - groups: mockGroups, - hasTriggeredBy: false, - }); - }); - - it('should render provided title', () => { - expect(component.$el.querySelector('.stage-name').textContent.trim()).toEqual('foo'); - }); - - it('should render the provided groups', () => { - expect(component.$el.querySelectorAll('.builds-container > ul > li').length).toEqual(3); - }); - - describe('jobId', () => { - it('escapes job name', () => { - component = mountComponent(StageColumnComponent, { - groups: [ - { - id: 4259, - name: '<img src=x onerror=alert(document.domain)>', - status: { - icon: 'status_success', - label: 'success', - tooltip: '<img src=x onerror=alert(document.domain)>', - }, - }, - ], - title: 'test', - hasTriggeredBy: false, - }); - - expect(component.$el.querySelector('.builds-container li').getAttribute('id')).toEqual( - 'ci-badge-<img src=x onerror=alert(document.domain)>', - ); - }); - }); - - describe('with action', () => { - it('renders action button', () => { - component = mountComponent(StageColumnComponent, { - groups: [ - { - id: 4259, - name: '<img src=x onerror=alert(document.domain)>', - status: { - icon: 'status_success', - label: 'success', - tooltip: '<img src=x onerror=alert(document.domain)>', - }, - }, - ], - title: 'test', - hasTriggeredBy: false, - action: { - icon: 'play', - title: 'Play all', - path: 'action', - }, - }); - - expect(component.$el.querySelector('.js-stage-action')).not.toBeNull(); - }); - }); - - describe('without action', () => { - it('does not render action button', () => { - component = mountComponent(StageColumnComponent, { - groups: [ - { - id: 4259, - name: '<img src=x onerror=alert(document.domain)>', - status: { - icon: 'status_success', - label: 'success', - tooltip: '<img src=x onerror=alert(document.domain)>', - }, - }, - ], - title: 'test', - hasTriggeredBy: false, - }); - - expect(component.$el.querySelector('.js-stage-action')).toBeNull(); - }); - }); -}); |