diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-05-12 12:36:10 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-05-12 12:36:10 +0000 |
commit | 8f47540ab828a429b0f14c64e54fcc9ff0862e95 (patch) | |
tree | 9f20040fb83e639e4f71c4b8252ea4148cddc876 /spec/javascripts | |
parent | 6e78508cd2021fd2dd69c786f58be15a21748748 (diff) | |
parent | dd70776f67a7377deeaf369d59fd09e630f2f7ed (diff) | |
download | gitlab-ce-8f47540ab828a429b0f14c64e54fcc9ff0862e95.tar.gz |
Merge branch 'acet-mr-widget-fix-link' into 'master'
MRWidget: Fix target branch link.
See merge request !11267
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js | 13 | ||||
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/states/mr_widget_closed_spec.js | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js index 48f816c8460..7f3eea7d2e5 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js @@ -48,10 +48,12 @@ describe('MRWidgetHeader', () => { describe('template', () => { let vm; let el; + const sourceBranchPath = '/foo/bar/mr-widget-refactor'; const mr = { divergedCommitsCount: 12, sourceBranch: 'mr-widget-refactor', - sourceBranchLink: '/foo/bar/mr-widget-refactor', + sourceBranchLink: `<a href="${sourceBranchPath}">mr-widget-refactor</a>`, + targetBranchPath: 'foo/bar/commits-path', targetBranch: 'master', isOpen: true, emailPatchesPath: '/mr/email-patches', @@ -65,8 +67,13 @@ describe('MRWidgetHeader', () => { it('should render template elements correctly', () => { expect(el.classList.contains('mr-source-target')).toBeTruthy(); - expect(el.querySelectorAll('.label-branch')[0].textContent).toContain(mr.sourceBranch); - expect(el.querySelectorAll('.label-branch')[1].textContent).toContain(mr.targetBranch); + const sourceBranchLink = el.querySelectorAll('.label-branch')[0]; + const targetBranchLink = el.querySelectorAll('.label-branch')[1]; + + expect(sourceBranchLink.textContent).toContain(mr.sourceBranch); + expect(targetBranchLink.textContent).toContain(mr.targetBranch); + expect(sourceBranchLink.querySelector('a').getAttribute('href')).toEqual(sourceBranchPath); + expect(targetBranchLink.querySelector('a').getAttribute('href')).toEqual(mr.targetBranchPath); expect(el.querySelector('.diverged-commits-count').textContent).toContain('12 commits behind'); expect(el.textContent).toContain('Check out branch'); diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_closed_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_closed_spec.js index 78a70725e94..47303d1e80f 100644 --- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_closed_spec.js +++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_closed_spec.js @@ -3,7 +3,7 @@ import closedComponent from '~/vue_merge_request_widget/components/states/mr_wid const mr = { targetBranch: 'good-branch', - targetBranchCommitsPath: '/good-branch', + targetBranchPath: '/good-branch', closedBy: { name: 'Fatih Acet', username: 'fatihacet', @@ -44,7 +44,7 @@ describe('MRWidgetClosed', () => { expect(el.querySelector('h4').textContent).toContain('Closed by'); expect(el.querySelector('h4').textContent).toContain(mr.closedBy.name); expect(el.textContent).toContain('The changes were not merged into'); - expect(el.querySelector('.label-branch').getAttribute('href')).toEqual(mr.targetBranchCommitsPath); + expect(el.querySelector('.label-branch').getAttribute('href')).toEqual(mr.targetBranchPath); expect(el.querySelector('.label-branch').textContent).toContain(mr.targetBranch); }); }); |