diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:39 +0300 |
commit | dc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (patch) | |
tree | 70945aa6721a271fc8057efa13c3216a03fbac45 /spec/frontend/releases/components | |
parent | cd52759ee33051b8ad7b88b02ba7954e4fad7018 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/releases/components')
3 files changed, 73 insertions, 11 deletions
diff --git a/spec/frontend/releases/components/evidence_block_spec.js b/spec/frontend/releases/components/evidence_block_spec.js index fb62f4a3bfe..c76a0e04dce 100644 --- a/spec/frontend/releases/components/evidence_block_spec.js +++ b/spec/frontend/releases/components/evidence_block_spec.js @@ -67,7 +67,7 @@ describe('Evidence Block', () => { }); it('renders the correct hover text', () => { - expect(wrapper.find(ClipboardButton).attributes('title')).toBe('Copy commit SHA'); + expect(wrapper.find(ClipboardButton).attributes('title')).toBe('Copy evidence SHA'); }); it('copies the sha', () => { diff --git a/spec/frontend/releases/components/release_block_milestone_info_spec.js b/spec/frontend/releases/components/release_block_milestone_info_spec.js index 10f5db96b31..0e79c45b337 100644 --- a/spec/frontend/releases/components/release_block_milestone_info_spec.js +++ b/spec/frontend/releases/components/release_block_milestone_info_spec.js @@ -10,11 +10,9 @@ describe('Release block milestone info', () => { let wrapper; let milestones; - const factory = milestonesProp => { + const factory = props => { wrapper = mount(ReleaseBlockMilestoneInfo, { - propsData: { - milestones: milestonesProp, - }, + propsData: props, }); return wrapper.vm.$nextTick(); @@ -26,6 +24,7 @@ describe('Release block milestone info', () => { afterEach(() => { wrapper.destroy(); + wrapper = null; }); const milestoneProgressBarContainer = () => wrapper.find('.js-milestone-progress-bar-container'); @@ -33,7 +32,7 @@ describe('Release block milestone info', () => { const issuesContainer = () => wrapper.find('.js-issues-container'); describe('with default props', () => { - beforeEach(() => factory(milestones)); + beforeEach(() => factory({ milestones })); it('renders the correct percentage', () => { expect(milestoneProgressBarContainer().text()).toContain('41% complete'); @@ -102,7 +101,7 @@ describe('Release block milestone info', () => { .map(m => m.title) .join(' • '); - return factory(lotsOfMilestones); + return factory({ milestones: lotsOfMilestones }); }); const clickShowMoreFewerButton = () => { @@ -153,12 +152,12 @@ describe('Release block milestone info', () => { ...m, issueStats: { ...m.issueStats, - opened: 0, + total: 0, closed: 0, }, })); - return factory(milestones); + return factory({ milestones }); }); expectAllZeros(); @@ -171,9 +170,72 @@ describe('Release block milestone info', () => { issueStats: undefined, })); - return factory(milestones); + return factory({ milestones }); }); expectAllZeros(); }); + + describe('Issue links', () => { + const findOpenIssuesLink = () => wrapper.find({ ref: 'openIssuesLink' }); + const findOpenIssuesText = () => wrapper.find({ ref: 'openIssuesText' }); + const findClosedIssuesLink = () => wrapper.find({ ref: 'closedIssuesLink' }); + const findClosedIssuesText = () => wrapper.find({ ref: 'closedIssuesText' }); + + describe('when openIssuePath is provided', () => { + const openIssuesPath = '/path/to/open/issues'; + + beforeEach(() => { + return factory({ milestones, openIssuesPath }); + }); + + it('renders the open issues as a link', () => { + expect(findOpenIssuesLink().exists()).toBe(true); + expect(findOpenIssuesText().exists()).toBe(false); + }); + + it('renders the open issues link with the correct href', () => { + expect(findOpenIssuesLink().attributes().href).toBe(openIssuesPath); + }); + }); + + describe('when openIssuePath is not provided', () => { + beforeEach(() => { + return factory({ milestones }); + }); + + it('renders the open issues as plain text', () => { + expect(findOpenIssuesLink().exists()).toBe(false); + expect(findOpenIssuesText().exists()).toBe(true); + }); + }); + + describe('when closedIssuePath is provided', () => { + const closedIssuesPath = '/path/to/closed/issues'; + + beforeEach(() => { + return factory({ milestones, closedIssuesPath }); + }); + + it('renders the closed issues as a link', () => { + expect(findClosedIssuesLink().exists()).toBe(true); + expect(findClosedIssuesText().exists()).toBe(false); + }); + + it('renders the closed issues link with the correct href', () => { + expect(findClosedIssuesLink().attributes().href).toBe(closedIssuesPath); + }); + }); + + describe('when closedIssuePath is not provided', () => { + beforeEach(() => { + return factory({ milestones }); + }); + + it('renders the closed issues as plain text', () => { + expect(findClosedIssuesLink().exists()).toBe(false); + expect(findClosedIssuesText().exists()).toBe(true); + }); + }); + }); }); diff --git a/spec/frontend/releases/components/release_block_spec.js b/spec/frontend/releases/components/release_block_spec.js index 227998b0271..7ea2379ea35 100644 --- a/spec/frontend/releases/components/release_block_spec.js +++ b/spec/frontend/releases/components/release_block_spec.js @@ -92,7 +92,7 @@ describe('Release block', () => { expect(wrapper.findAll('.js-assets-list li').length).toEqual(release.assets.links.length); expect(wrapper.find('.js-assets-list li a').attributes().href).toEqual( - first(release.assets.links).url, + first(release.assets.links).directAssetUrl, ); expect(wrapper.find('.js-assets-list li a').text()).toContain( |