Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2018-02-20 22:43:37 +0300
committerJose Ivan Vargas <jvargas@gitlab.com>2018-03-02 01:10:04 +0300
commit84e01b3e7a521c66077245a62247bd47a3731ddb (patch)
tree16a3be2872fd365f9606fc39765fce285a619dca /spec/javascripts/pages
parentd5c001864964afb73efca0c6b592f8a1e4d152b9 (diff)
Changed selector names, address code concerns
Diffstat (limited to 'spec/javascripts/pages')
-rw-r--r--spec/javascripts/pages/labels/components/promote_label_modal_spec.js22
-rw-r--r--spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js21
2 files changed, 15 insertions, 28 deletions
diff --git a/spec/javascripts/pages/labels/components/promote_label_modal_spec.js b/spec/javascripts/pages/labels/components/promote_label_modal_spec.js
index 66b9ac648d1..e68c957e135 100644
--- a/spec/javascripts/pages/labels/components/promote_label_modal_spec.js
+++ b/spec/javascripts/pages/labels/components/promote_label_modal_spec.js
@@ -7,35 +7,28 @@ import mountComponent from '../../../helpers/vue_mount_component_helper';
describe('Promote label modal', () => {
let vm;
- let Component;
+ const Component = Vue.extend(promoteLabelModal);
const labelMockData = {
labelTitle: 'Documentation',
labelColor: '#5cb85c',
- url: `${gl.TEST_HOST}/dummy/endpoint`,
+ labelTextColor: '#ffffff',
+ url: `${gl.TEST_HOST}/dummy/promote/labels`,
};
- beforeEach(() => {
- Component = Vue.extend(promoteLabelModal);
- });
-
describe('Modal title and description', () => {
beforeEach(() => {
- vm = mountComponent(Component, {
- ...labelMockData,
- });
+ vm = mountComponent(Component, labelMockData);
});
afterEach(() => {
vm.$destroy();
});
- it('should contain the proper description', () => {
+ it('contains the proper description', () => {
expect(vm.text).toContain('Promoting this label will make it available for all projects inside the group');
- expect(vm.text).toContain('Existing project labels with the same name will be merged');
- expect(vm.text).toContain('This action cannot be reversed.');
});
- it('should contain a label span with the color', () => {
+ it('contains a label span with the color', () => {
const labelFromTitle = vm.$el.querySelector('.modal-header .label.color-label');
expect(labelFromTitle.style.backgroundColor).not.toBe(null);
@@ -55,7 +48,7 @@ describe('Promote label modal', () => {
vm.$destroy();
});
- it('should redirect when a label is promoted', (done) => {
+ it('redirects when a label is promoted', (done) => {
const responseURL = `${gl.TEST_HOST}/dummy/endpoint`;
spyOn(axios, 'post').and.callFake((url) => {
expect(url).toBe(labelMockData.url);
@@ -71,6 +64,7 @@ describe('Promote label modal', () => {
vm.onSubmit()
.then(() => {
expect(redirectSpy).toHaveBeenCalledWith(responseURL);
+ expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', { labelUrl: labelMockData.url, successful: true });
})
.then(done)
.catch(done.fail);
diff --git a/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js b/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js
index f201edddce0..d0ec4df7232 100644
--- a/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js
+++ b/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js
@@ -7,34 +7,26 @@ import mountComponent from '../../../../helpers/vue_mount_component_helper';
describe('Promote milestone modal', () => {
let vm;
- let Component;
+ const Component = Vue.extend(promoteMilestoneModal);
const milestoneMockData = {
milestoneTitle: 'v1.0',
- url: `${gl.TEST_HOST}/dummy/endpoint`,
+ url: `${gl.TEST_HOST}/dummy/promote/milestones`,
};
- beforeEach(() => {
- Component = Vue.extend(promoteMilestoneModal);
- });
-
describe('Modal title and description', () => {
beforeEach(() => {
- vm = mountComponent(Component, {
- ...milestoneMockData,
- });
+ vm = mountComponent(Component, milestoneMockData);
});
afterEach(() => {
vm.$destroy();
});
- it('should contain the proper description', () => {
+ it('contains the proper description', () => {
expect(vm.text).toContain('Promoting this milestone will make it available for all projects inside the group.');
- expect(vm.text).toContain('Existing project milestones with the same name will be merged.');
- expect(vm.text).toContain('This action cannot be reversed.');
});
- it('should contain the correct title', () => {
+ it('contains the correct title', () => {
expect(vm.title).toEqual('Promote v1.0 to group milestone?');
});
});
@@ -51,7 +43,7 @@ describe('Promote milestone modal', () => {
vm.$destroy();
});
- it('should redirect when a milestone is promoted', (done) => {
+ it('redirects when a milestone is promoted', (done) => {
const responseURL = `${gl.TEST_HOST}/dummy/endpoint`;
spyOn(axios, 'post').and.callFake((url) => {
expect(url).toBe(milestoneMockData.url);
@@ -67,6 +59,7 @@ describe('Promote milestone modal', () => {
vm.onSubmit()
.then(() => {
expect(redirectSpy).toHaveBeenCalledWith(responseURL);
+ expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', { milestoneUrl: milestoneMockData.url, successful: true });
})
.then(done)
.catch(done.fail);