Commit 4e5fc194 authored by Fatih Acet's avatar Fatih Acet

Show Download diff links in closed MRs

Download MR diffs links were only available for open MRs,
however it may still be useful for closed MRs.
parent 645303c7
...@@ -109,7 +109,8 @@ export default { ...@@ -109,7 +109,8 @@ export default {
></div> ></div>
</div> </div>
<div v-if="mr.isOpen" class="branch-actions d-flex"> <div class="branch-actions d-flex">
<template v-if="mr.isOpen">
<a <a
v-if="!mr.sourceBranchRemoved" v-if="!mr.sourceBranchRemoved"
v-tooltip v-tooltip
...@@ -132,6 +133,7 @@ export default { ...@@ -132,6 +133,7 @@ export default {
> >
{{ s__('mrWidget|Check out branch') }} {{ s__('mrWidget|Check out branch') }}
</button> </button>
</template>
<span class="dropdown"> <span class="dropdown">
<button <button
type="button" type="button"
......
---
title: Show download diff links for closed MRs
merge_request: 26772
author:
type: changed
...@@ -15,6 +15,16 @@ describe('MRWidgetHeader', () => { ...@@ -15,6 +15,16 @@ describe('MRWidgetHeader', () => {
gon.relative_url_root = ''; gon.relative_url_root = '';
}); });
const expectDownloadDropdownItems = () => {
const downloadEmailPatchesEl = vm.$el.querySelector('.js-download-email-patches');
const downloadPlainDiffEl = vm.$el.querySelector('.js-download-plain-diff');
expect(downloadEmailPatchesEl.textContent.trim()).toEqual('Email patches');
expect(downloadEmailPatchesEl.getAttribute('href')).toEqual('/mr/email-patches');
expect(downloadPlainDiffEl.textContent.trim()).toEqual('Plain diff');
expect(downloadPlainDiffEl.getAttribute('href')).toEqual('/mr/plainDiffPath');
};
describe('computed', () => { describe('computed', () => {
describe('shouldShowCommitsBehindText', () => { describe('shouldShowCommitsBehindText', () => {
it('return true when there are divergedCommitsCount', () => { it('return true when there are divergedCommitsCount', () => {
...@@ -207,21 +217,7 @@ describe('MRWidgetHeader', () => { ...@@ -207,21 +217,7 @@ describe('MRWidgetHeader', () => {
}); });
it('renders download dropdown with links', () => { it('renders download dropdown with links', () => {
expect(vm.$el.querySelector('.js-download-email-patches').textContent.trim()).toEqual( expectDownloadDropdownItems();
'Email patches',
);
expect(vm.$el.querySelector('.js-download-email-patches').getAttribute('href')).toEqual(
'/mr/email-patches',
);
expect(vm.$el.querySelector('.js-download-plain-diff').textContent.trim()).toEqual(
'Plain diff',
);
expect(vm.$el.querySelector('.js-download-plain-diff').getAttribute('href')).toEqual(
'/mr/plainDiffPath',
);
}); });
}); });
...@@ -250,10 +246,8 @@ describe('MRWidgetHeader', () => { ...@@ -250,10 +246,8 @@ describe('MRWidgetHeader', () => {
expect(button).toEqual(null); expect(button).toEqual(null);
}); });
it('does not render download dropdown with links', () => { it('renders download dropdown with links', () => {
expect(vm.$el.querySelector('.js-download-email-patches')).toEqual(null); expectDownloadDropdownItems();
expect(vm.$el.querySelector('.js-download-plain-diff')).toEqual(null);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment