BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0f000716
Commit
0f000716
authored
Jan 22, 2018
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable MR check out button when source branch is deleted
After source branch deletion the Merge request `Check out branch` button is disabled.
parent
092a34fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
mr_widget_header.js
...s/vue_merge_request_widget/components/mr_widget_header.js
+1
-0
42255-disable-mr-checkout-button-when-source-branch-deleted.yml
...disable-mr-checkout-button-when-source-branch-deleted.yml
+5
-0
mr_widget_header_spec.js
...scripts/vue_mr_widget/components/mr_widget_header_spec.js
+27
-11
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js
View file @
0f000716
...
...
@@ -76,6 +76,7 @@ export default {
<a
href="#modal_merge_info"
data-toggle="modal"
:disabled="mr.sourceBranchRemoved"
class="btn btn-sm inline">
Check out branch
</a>
...
...
changelogs/unreleased/42255-disable-mr-checkout-button-when-source-branch-deleted.yml
0 → 100644
View file @
0f000716
---
title
:
Disable MR check out button when source branch is deleted
merge_request
:
16631
author
:
Jacopo Beschi @jacopo-beschi
type
:
fixed
spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js
View file @
0f000716
...
...
@@ -48,20 +48,23 @@ describe('MRWidgetHeader', () => {
describe
(
'template'
,
()
=>
{
let
vm
;
let
el
;
let
mr
;
const
sourceBranchPath
=
'/foo/bar/mr-widget-refactor'
;
const
mr
=
{
divergedCommitsCount
:
12
,
sourceBranch
:
'mr-widget-refactor'
,
sourceBranchLink
:
`<a href="
${
sourceBranchPath
}
">mr-widget-refactor</a>`
,
targetBranchPath
:
'foo/bar/commits-path'
,
targetBranchTreePath
:
'foo/bar/tree/path'
,
targetBranch
:
'master'
,
isOpen
:
true
,
emailPatchesPath
:
'/mr/email-patches'
,
plainDiffPath
:
'/mr/plainDiffPath'
,
};
beforeEach
(()
=>
{
mr
=
{
divergedCommitsCount
:
12
,
sourceBranch
:
'mr-widget-refactor'
,
sourceBranchLink
:
`<a href="
${
sourceBranchPath
}
">mr-widget-refactor</a>`
,
sourceBranchRemoved
:
false
,
targetBranchPath
:
'foo/bar/commits-path'
,
targetBranchTreePath
:
'foo/bar/tree/path'
,
targetBranch
:
'master'
,
isOpen
:
true
,
emailPatchesPath
:
'/mr/email-patches'
,
plainDiffPath
:
'/mr/plainDiffPath'
,
};
vm
=
createComponent
(
mr
);
el
=
vm
.
$el
;
});
...
...
@@ -82,6 +85,8 @@ describe('MRWidgetHeader', () => {
expect
(
el
.
textContent
).
toContain
(
'Check out branch'
);
expect
(
el
.
querySelectorAll
(
'.dropdown li a'
)[
0
].
getAttribute
(
'href'
)).
toEqual
(
mr
.
emailPatchesPath
);
expect
(
el
.
querySelectorAll
(
'.dropdown li a'
)[
1
].
getAttribute
(
'href'
)).
toEqual
(
mr
.
plainDiffPath
);
expect
(
el
.
querySelector
(
'a[href="#modal_merge_info"]'
).
getAttribute
(
'disabled'
)).
toBeNull
();
});
it
(
'should not have right action links if the MR state is not open'
,
(
done
)
=>
{
...
...
@@ -101,5 +106,16 @@ describe('MRWidgetHeader', () => {
done
();
});
});
it
(
'should disable check out branch button if source branch has been removed'
,
(
done
)
=>
{
vm
.
mr
.
sourceBranchRemoved
=
true
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
el
.
querySelector
(
'a[href="#modal_merge_info"]'
).
getAttribute
(
'disabled'
)).
toBe
(
'disabled'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment