Merge branch '29249-show-download-diff-even-when-merge-request-is-closed' into 'master'

Resolve "Show download diff even when merge request is closed"

Closes #29249

See merge request gitlab-org/gitlab-ce!26772
This commit is contained in:
Mike Greiling 2019-04-03 18:42:31 +00:00
commit 6202820c16
3 changed files with 43 additions and 42 deletions

View file

@ -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"

View file

@ -0,0 +1,5 @@
---
title: Show download diff links for closed MRs
merge_request: 26772
author:
type: changed

View file

@ -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', () => {
@ -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();
});
});
@ -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();
});
});