Skip to content
Snippets Groups Projects
Unverified Commit 4e5fc194 authored by Fatih Acet's avatar Fatih Acet
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -109,29 +109,31 @@ export default {
></div>
</div>
 
<div v-if="mr.isOpen" class="branch-actions d-flex">
<a
v-if="!mr.sourceBranchRemoved"
v-tooltip
:href="webIdePath"
:title="ideButtonTitle"
:class="{ disabled: !mr.canPushToSourceBranch }"
class="btn btn-default js-web-ide d-none d-md-inline-block append-right-8"
data-placement="bottom"
tabindex="0"
role="button"
>
{{ s__('mrWidget|Open in Web IDE') }}
</a>
<button
:disabled="mr.sourceBranchRemoved"
data-target="#modal_merge_info"
data-toggle="modal"
class="btn btn-default js-check-out-branch append-right-default"
type="button"
>
{{ s__('mrWidget|Check out branch') }}
</button>
<div class="branch-actions d-flex">
<template v-if="mr.isOpen">
<a
v-if="!mr.sourceBranchRemoved"
v-tooltip
:href="webIdePath"
:title="ideButtonTitle"
:class="{ disabled: !mr.canPushToSourceBranch }"
class="btn btn-default js-web-ide d-none d-md-inline-block append-right-8"
data-placement="bottom"
tabindex="0"
role="button"
>
{{ s__('mrWidget|Open in Web IDE') }}
</a>
<button
:disabled="mr.sourceBranchRemoved"
data-target="#modal_merge_info"
data-toggle="modal"
class="btn btn-default js-check-out-branch append-right-default"
type="button"
>
{{ s__('mrWidget|Check out branch') }}
</button>
</template>
<span class="dropdown">
<button
type="button"
Loading
Loading
---
title: Show download diff links for closed MRs
merge_request: 26772
author:
type: changed
Loading
Loading
@@ -15,6 +15,16 @@ describe('MRWidgetHeader', () => {
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('shouldShowCommitsBehindText', () => {
it('return true when there are divergedCommitsCount', () => {
Loading
Loading
@@ -207,21 +217,7 @@ describe('MRWidgetHeader', () => {
});
 
it('renders download dropdown with links', () => {
expect(vm.$el.querySelector('.js-download-email-patches').textContent.trim()).toEqual(
'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',
);
expectDownloadDropdownItems();
});
});
 
Loading
Loading
@@ -250,10 +246,8 @@ describe('MRWidgetHeader', () => {
expect(button).toEqual(null);
});
 
it('does not render download dropdown with links', () => {
expect(vm.$el.querySelector('.js-download-email-patches')).toEqual(null);
expect(vm.$el.querySelector('.js-download-plain-diff')).toEqual(null);
it('renders download dropdown with links', () => {
expectDownloadDropdownItems();
});
});
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment