diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-10-17 11:11:52 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-10-17 11:11:52 +0000 |
commit | b01dacffffd4df3592611afb43e9309ec6cc7f9c (patch) | |
tree | b755bb8213c9c275fff69b2a76a93cd7af0512bd /spec/javascripts | |
parent | b2da681fd07d03a9494ef427cd6fa8c5b32be194 (diff) | |
download | gitlab-ce-b01dacffffd4df3592611afb43e9309ec6cc7f9c.tar.gz |
Replace job with group in frontend components to be consistent with backend
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/pipelines/graph/job_group_dropdown_spec.js (renamed from spec/javascripts/pipelines/graph/dropdown_job_component_spec.js) | 18 | ||||
-rw-r--r-- | spec/javascripts/pipelines/graph/job_item_spec.js (renamed from spec/javascripts/pipelines/graph/job_component_spec.js) | 6 | ||||
-rw-r--r-- | spec/javascripts/pipelines/graph/stage_column_component_spec.js | 17 |
3 files changed, 20 insertions, 21 deletions
diff --git a/spec/javascripts/pipelines/graph/dropdown_job_component_spec.js b/spec/javascripts/pipelines/graph/job_group_dropdown_spec.js index 2b47ca236b2..24631cc1c89 100644 --- a/spec/javascripts/pipelines/graph/dropdown_job_component_spec.js +++ b/spec/javascripts/pipelines/graph/job_group_dropdown_spec.js @@ -1,12 +1,12 @@ import Vue from 'vue'; -import component from '~/pipelines/components/graph/dropdown_job_component.vue'; +import JobGroupDropdown from '~/pipelines/components/graph/job_group_dropdown.vue'; import mountComponent from 'spec/helpers/vue_mount_component_helper'; -describe('dropdown job component', () => { - const Component = Vue.extend(component); +describe('job group dropdown component', () => { + const Component = Vue.extend(JobGroupDropdown); let vm; - const mock = { + const group = { jobs: [ { id: 4256, @@ -71,15 +71,15 @@ describe('dropdown job component', () => { }); beforeEach(() => { - vm = mountComponent(Component, { job: mock }); + vm = mountComponent(Component, { group }); }); - it('renders button with job name and size', () => { - expect(vm.$el.querySelector('button').textContent).toContain(mock.name); - expect(vm.$el.querySelector('button').textContent).toContain(mock.size); + it('renders button with group name and size', () => { + expect(vm.$el.querySelector('button').textContent).toContain(group.name); + expect(vm.$el.querySelector('button').textContent).toContain(group.size); }); it('renders dropdown with jobs', () => { - expect(vm.$el.querySelectorAll('.scrollable-menu>ul>li').length).toEqual(mock.jobs.length); + expect(vm.$el.querySelectorAll('.scrollable-menu>ul>li').length).toEqual(group.jobs.length); }); }); diff --git a/spec/javascripts/pipelines/graph/job_component_spec.js b/spec/javascripts/pipelines/graph/job_item_spec.js index 0ae448f2ea8..88bc4676699 100644 --- a/spec/javascripts/pipelines/graph/job_component_spec.js +++ b/spec/javascripts/pipelines/graph/job_item_spec.js @@ -1,9 +1,9 @@ import Vue from 'vue'; -import jobComponent from '~/pipelines/components/graph/job_component.vue'; +import JobItem from '~/pipelines/components/graph/job_item.vue'; import mountComponent from 'spec/helpers/vue_mount_component_helper'; -describe('pipeline graph job component', () => { - const JobComponent = Vue.extend(jobComponent); +describe('pipeline graph job item', () => { + const JobComponent = Vue.extend(JobItem); let component; const mockJob = { diff --git a/spec/javascripts/pipelines/graph/stage_column_component_spec.js b/spec/javascripts/pipelines/graph/stage_column_component_spec.js index f6e6bd3132e..d0b8f877d6f 100644 --- a/spec/javascripts/pipelines/graph/stage_column_component_spec.js +++ b/spec/javascripts/pipelines/graph/stage_column_component_spec.js @@ -25,17 +25,16 @@ describe('stage column component', () => { }; beforeEach(() => { - - const mockJobs = []; + const mockGroups = []; for (let i = 0; i < 3; i += 1) { const mockedJob = Object.assign({}, mockJob); mockedJob.id += i; - mockJobs.push(mockedJob); + mockGroups.push(mockedJob); } component = mountComponent(StageColumnComponent, { title: 'foo', - jobs: mockJobs, + groups: mockGroups, }); }); @@ -43,14 +42,14 @@ describe('stage column component', () => { expect(component.$el.querySelector('.stage-name').textContent.trim()).toEqual('foo'); }); - it('should render the provided jobs', () => { + 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, { - jobs: [ + groups: [ { id: 4259, name: '<img src=x onerror=alert(document.domain)>', @@ -64,9 +63,9 @@ describe('stage column component', () => { title: 'test', }); - expect( - component.$el.querySelector('.builds-container li').getAttribute('id'), - ).toEqual('ci-badge-<img src=x onerror=alert(document.domain)>'); + expect(component.$el.querySelector('.builds-container li').getAttribute('id')).toEqual( + 'ci-badge-<img src=x onerror=alert(document.domain)>', + ); }); }); }); |