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,29 +109,31 @@ export default { ...@@ -109,29 +109,31 @@ export default {
></div> ></div>
</div> </div>
<div v-if="mr.isOpen" class="branch-actions d-flex"> <div class="branch-actions d-flex">
<a <template v-if="mr.isOpen">
v-if="!mr.sourceBranchRemoved" <a
v-tooltip v-if="!mr.sourceBranchRemoved"
:href="webIdePath" v-tooltip
:title="ideButtonTitle" :href="webIdePath"
:class="{ disabled: !mr.canPushToSourceBranch }" :title="ideButtonTitle"
class="btn btn-default js-web-ide d-none d-md-inline-block append-right-8" :class="{ disabled: !mr.canPushToSourceBranch }"
data-placement="bottom" class="btn btn-default js-web-ide d-none d-md-inline-block append-right-8"
tabindex="0" data-placement="bottom"
role="button" tabindex="0"
> role="button"
{{ s__('mrWidget|Open in Web IDE') }} >
</a> {{ s__('mrWidget|Open in Web IDE') }}
<button </a>
:disabled="mr.sourceBranchRemoved" <button
data-target="#modal_merge_info" :disabled="mr.sourceBranchRemoved"
data-toggle="modal" data-target="#modal_merge_info"
class="btn btn-default js-check-out-branch append-right-default" data-toggle="modal"
type="button" class="btn btn-default js-check-out-branch append-right-default"
> type="button"
{{ s__('mrWidget|Check out branch') }} >
</button> {{ s__('mrWidget|Check out branch') }}
</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