提交 8f47540a 编写于 作者: F Filipa Lacerda

Merge branch 'acet-mr-widget-fix-link' into 'master'

MRWidget: Fix target branch link.

See merge request !11267
......@@ -83,7 +83,7 @@ export default {
:title="isBranchTitleLong(mr.targetBranch) ? mr.targetBranch : ''"
data-placement="bottom">
<a
:href="mr.targetBranchCommitsPath">
:href="mr.targetBranchPath">
{{mr.targetBranch}}
</a>
</span>
......
......@@ -20,7 +20,7 @@ export default {
<p>
The changes were not merged into
<a
:href="mr.targetBranchCommitsPath"
:href="mr.targetBranchPath"
class="label-branch">
{{mr.targetBranch}}</a>.
</p>
......
......@@ -16,7 +16,7 @@ export default {
The changes will be merged into
<span class="label-branch">
<a :href="mr.targetBranchPath">{{mr.targetBranch}}</a>
</span>
</span>.
</p>
</section>
</div>
......
......@@ -87,7 +87,7 @@ export default {
:href="mr.targetBranchPath"
class="label-branch">
{{mr.targetBranch}}
</a>
</a>.
</p>
<p v-if="mr.shouldRemoveSourceBranch">
The source branch will be removed.
......
......@@ -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');
......
......@@ -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);
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册