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
a48c07da
Commit
a48c07da
authored
Sep 26, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use js- classes instead of Vue refs in tests for some perf
See
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14272#note_41419104
parent
f2c23ab8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
27 deletions
+34
-27
mr_widget_status_icon.js
..._merge_request_widget/components/mr_widget_status_icon.js
+1
-2
mr_widget_conflicts.js
...e_request_widget/components/states/mr_widget_conflicts.js
+8
-11
mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+2
-3
mr_widget_conflicts_spec.js
...e_mr_widget/components/states/mr_widget_conflicts_spec.js
+19
-7
mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+4
-4
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
View file @
a48c07da
...
...
@@ -26,9 +26,8 @@ export default {
<ci-icon v-else :status="statusObj" />
<button
v-if="showDisabledButton"
ref="mergeButton"
type="button"
class="btn btn-success btn-sm"
class="
js-disabled-merge-button
btn btn-success btn-sm"
disabled="true">
Merge
</button>
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
View file @
a48c07da
...
...
@@ -11,16 +11,15 @@ export default {
template
:
`
<div class="mr-widget-body media">
<status-icon
ref="statusIcon"
status="failed"
showDisabledButton />
<div class="media-body space-children">
<
template v-if="mr.ffOnlyEnabled">
<span class="bold">
Fast-forward merge is not possible.
To merge this request, first rebase locally
</span>
</
template
>
<
span
v-if="mr.ffOnlyEnabled"
class="bold">
Fast-forward merge is not possible.
To merge this request, first rebase locally
</
span
>
<template v-else>
<span class="bold">
There are merge conflicts<span v-if="!mr.canMerge">.</span>
...
...
@@ -30,15 +29,13 @@ export default {
</span>
<a
v-if="mr.canMerge && mr.conflictResolutionPath"
ref="resolveConflictsButton"
:href="mr.conflictResolutionPath"
class="btn btn-default btn-xs">
class="
js-resolve-conflicts-button
btn btn-default btn-xs">
Resolve conflicts
</a>
<a
v-if="mr.canMerge"
ref="mergeLocallyButton"
class="btn btn-default btn-xs"
class="js-merge-locally-button btn btn-default btn-xs"
data-toggle="modal"
href="#modal_merge_info">
Merge locally
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
a48c07da
...
...
@@ -286,15 +286,14 @@ export default {
<span
v-if="mr.ffOnlyEnabled"
ref="fastForwardM
essage">
class="js-fast-forward-m
essage">
Fast-forward merge without a merge commit
</span>
<button
v-else
ref="modifyCommitMessageButton"
@click="toggleCommitMessageEditor"
:disabled="isMergeButtonDisabled"
class="btn btn-default btn-xs"
class="
js-modify-commit-message-button
btn btn-default btn-xs"
type="button">
Modify commit message
</button>
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
a48c07da
...
...
@@ -28,25 +28,29 @@ describe('MRWidgetConflicts', () => {
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'should tell you about conflicts without bothering other people'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'There are merge conflicts'
);
expect
(
vm
.
$el
.
textContent
).
not
.
toContain
(
'ask someone with write access'
);
});
it
(
'should allow you to resolve the conflicts'
,
()
=>
{
const
resolveButton
=
vm
.
$
refs
.
resolveConflictsButton
;
const
resolveButton
=
vm
.
$
el
.
querySelector
(
'.js-resolve-conflicts-button'
)
;
expect
(
resolveButton
.
textContent
).
toContain
(
'Resolve conflicts'
);
expect
(
resolveButton
.
getAttribute
(
'href'
)).
toEqual
(
path
);
});
it
(
'should have merge buttons'
,
()
=>
{
const
mergeButton
=
vm
.
$
refs
.
statusIcon
.
$refs
.
mergeButton
;
const
mergeLocallyButton
=
vm
.
$
refs
.
mergeLocallyButton
;
const
mergeButton
=
vm
.
$
el
.
querySelector
(
'.js-disabled-merge-button'
)
;
const
mergeLocallyButton
=
vm
.
$
el
.
querySelector
(
'.js-merge-locally-button'
)
;
expect
(
mergeButton
.
textContent
).
toContain
(
'Merge'
);
expect
(
mergeButton
.
disabled
).
toBeTruthy
();
expect
(
mergeButton
.
classList
.
contains
(
'btn-success'
)).
to
BeTruthy
(
);
expect
(
mergeButton
.
classList
.
contains
(
'btn-success'
)).
to
Equal
(
true
);
expect
(
mergeLocallyButton
.
textContent
).
toContain
(
'Merge locally'
);
});
});
...
...
@@ -62,14 +66,18 @@ describe('MRWidgetConflicts', () => {
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'should show proper message'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'ask someone with write access'
);
});
it
(
'should not have action buttons'
,
()
=>
{
expect
(
vm
.
$
refs
.
statusIcon
.
$refs
.
mergeButton
).
toBeDefined
();
expect
(
vm
.
$
refs
.
resolveConflictsButton
).
toBeUndefined
();
expect
(
vm
.
$
refs
.
mergeLocallyButton
).
toBeUndefined
();
expect
(
vm
.
$
el
.
querySelector
(
'.js-disabled-merge-button'
)
).
toBeDefined
();
expect
(
vm
.
$
el
.
querySelector
(
'.js-resolve-conflicts-button'
)).
toBeNull
();
expect
(
vm
.
$
el
.
querySelector
(
'.js-merge-locally-button'
)).
toBeNull
();
});
});
...
...
@@ -84,6 +92,10 @@ describe('MRWidgetConflicts', () => {
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'should tell you to rebase locally'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'Fast-forward merge is not possible.'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'To merge this request, first rebase locally'
);
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
a48c07da
...
...
@@ -474,8 +474,8 @@ describe('MRWidgetReadyToMerge', () => {
mr
:
{
ffOnlyEnabled
:
false
},
});
expect
(
customVm
.
$
refs
.
fastForwardMessage
).
toBeUndefined
();
expect
(
customVm
.
$
refs
.
modifyCommitMessageButton
).
toBeDefined
();
expect
(
customVm
.
$
el
.
querySelector
(
'.js-fast-forward-message'
)).
toBeNull
();
expect
(
customVm
.
$
el
.
querySelector
(
'.js-modify-commit-message-button'
)
).
toBeDefined
();
});
it
(
'when fast-forward merge is enabled, only show fast-forward message'
,
()
=>
{
...
...
@@ -483,8 +483,8 @@ describe('MRWidgetReadyToMerge', () => {
mr
:
{
ffOnlyEnabled
:
true
},
});
expect
(
customVm
.
$
refs
.
fastForwardMessage
).
toBeDefined
();
expect
(
customVm
.
$
refs
.
modifyCommitMessageButton
).
toBeUndefined
();
expect
(
customVm
.
$
el
.
querySelector
(
'.js-fast-forward-message'
)
).
toBeDefined
();
expect
(
customVm
.
$
el
.
querySelector
(
'.js-modify-commit-message-button'
)).
toBeNull
();
});
});
});
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