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
3abceda6
Unverified
Commit
3abceda6
authored
Aug 02, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Improve repo_commit_section_spec
parent
4402eefa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
repo_commit_section.vue
app/assets/javascripts/repo/repo_commit_section.vue
+1
-1
repo_commit_section_spec.js
spec/javascripts/repo/repo_commit_section_spec.js
+17
-6
No files found.
app/assets/javascripts/repo/repo_commit_section.vue
View file @
3abceda6
...
...
@@ -77,7 +77,7 @@ export default RepoCommitSection;
</div>
<!-- Button Drop Down
-->
<div
class=
"form-group"
>
<div
class=
"form-group
target-branch
"
>
<label
class=
"col-md-4 control-label"
for=
"target-branch"
>
Target branch
</label>
<div
class=
"col-md-4"
>
<span
class=
"help-block"
>
{{
targetBranch
}}
</span>
...
...
spec/javascripts/repo/repo_commit_section_spec.js
View file @
3abceda6
...
...
@@ -5,21 +5,21 @@ import RepoHelper from '~/repo/repo_helper';
import
Api
from
'~/api'
;
fdescribe
(
'RepoCommitSection'
,
()
=>
{
const
branch
=
'master'
;
const
openedFiles
=
[{
id
:
0
,
changed
:
true
,
url
:
'master/url0'
,
url
:
`
${
branch
}
/url0`
,
newContent
:
'a'
,
},
{
id
:
1
,
changed
:
true
,
url
:
'master/url1'
,
url
:
`
${
branch
}
/url1`
,
newContent
:
'b'
,
},
{
id
:
2
,
changed
:
false
,
}];
const
branch
=
'master'
;
function
createComponent
()
{
const
RepoCommitSection
=
Vue
.
extend
(
repoCommitSection
);
...
...
@@ -29,13 +29,16 @@ fdescribe('RepoCommitSection', () => {
it
(
'renders a commit section'
,
()
=>
{
RepoStore
.
isCommitable
=
true
;
RepoStore
.
targetBranch
=
branch
;
RepoStore
.
openedFiles
=
openedFiles
;
spyOn
(
RepoHelper
,
'getBranch'
).
and
.
returnValue
(
branch
);
const
vm
=
createComponent
();
const
changedFiles
=
[...
vm
.
$el
.
querySelectorAll
(
'.changed-files > li'
)];
const
commitMessage
=
vm
.
$el
.
querySelector
(
'#commit-message'
);
const
submitCommit
=
vm
.
$el
.
querySelector
(
'.submit-commit'
);
const
targetBranch
=
vm
.
$el
.
querySelector
(
'.target-branch'
);
expect
(
vm
.
$el
.
querySelector
(
':scope > form'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'.staged-files'
).
textContent
).
toEqual
(
'Staged files (2)'
);
...
...
@@ -51,7 +54,10 @@ fdescribe('RepoCommitSection', () => {
expect
(
commitMessage
.
name
).
toEqual
(
'commit-message'
);
expect
(
submitCommit
.
type
).
toEqual
(
'submit'
);
expect
(
submitCommit
.
disabled
).
toBeTruthy
();
expect
(
submitCommit
.
querySelector
(
'.fa-spinner.fa-spin'
)).
toBeFalsy
();
expect
(
vm
.
$el
.
querySelector
(
'.commit-summary'
).
textContent
).
toEqual
(
'Commit 2 files'
);
expect
(
targetBranch
.
querySelector
(
':scope > label'
).
textContent
).
toEqual
(
'Target branch'
);
expect
(
targetBranch
.
querySelector
(
'.help-block'
).
textContent
).
toEqual
(
branch
);
});
it
(
'does not render if not isCommitable'
,
()
=>
{
...
...
@@ -82,6 +88,8 @@ fdescribe('RepoCommitSection', () => {
RepoStore
.
openedFiles
=
openedFiles
;
RepoStore
.
projectId
=
projectId
;
spyOn
(
RepoHelper
,
'getBranch'
).
and
.
returnValue
(
branch
);
const
vm
=
createComponent
();
const
commitMessageEl
=
vm
.
$el
.
querySelector
(
'#commit-message'
);
const
submitCommit
=
vm
.
$el
.
querySelector
(
'.submit-commit'
);
...
...
@@ -102,15 +110,18 @@ fdescribe('RepoCommitSection', () => {
expect
(
submitCommit
.
querySelector
(
'.fa-spinner.fa-spin'
)).
toBeTruthy
();
const
args
=
Api
.
commitMultiple
.
calls
.
allArgs
()[
0
];
const
{
commit_message
,
actions
}
=
args
[
1
];
const
{
commit_message
,
actions
,
branch
:
payloadBranch
}
=
args
[
1
];
expect
(
args
[
0
]).
toBe
(
projectId
);
expect
(
commit_message
).
toBe
(
commitMessage
);
expect
(
actions
.
length
).
toEqual
(
2
);
expect
(
payloadBranch
).
toEqual
(
branch
);
expect
(
actions
[
0
].
action
).
toEqual
(
'update'
);
expect
(
actions
[
1
].
action
).
toEqual
(
'update'
);
expect
(
actions
[
0
].
content
).
toEqual
(
'a'
);
expect
(
actions
[
1
].
content
).
toEqual
(
'b'
);
expect
(
actions
[
0
].
content
).
toEqual
(
openedFiles
[
0
].
newContent
);
expect
(
actions
[
1
].
content
).
toEqual
(
openedFiles
[
1
].
newContent
);
expect
(
actions
[
0
].
file_path
).
toEqual
(
RepoHelper
.
getFilePathFromFullPath
(
openedFiles
[
0
].
url
,
branch
));
expect
(
actions
[
1
].
file_path
).
toEqual
(
RepoHelper
.
getFilePathFromFullPath
(
openedFiles
[
1
].
url
,
branch
));
done
();
});
...
...
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