Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c1b29823
Commit
c1b29823
authored
Jun 25, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✅
added specs
parent
dd6a7ec1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
0 deletions
+100
-0
spec/javascripts/ide/components/commit_sidebar/form_spec.js
spec/javascripts/ide/components/commit_sidebar/form_spec.js
+12
-0
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
...scripts/ide/components/commit_sidebar/radio_group_spec.js
+15
-0
spec/javascripts/ide/stores/getters_spec.js
spec/javascripts/ide/stores/getters_spec.js
+19
-0
spec/javascripts/ide/stores/utils_spec.js
spec/javascripts/ide/stores/utils_spec.js
+54
-0
No files found.
spec/javascripts/ide/components/commit_sidebar/form_spec.js
View file @
c1b29823
...
...
@@ -147,4 +147,16 @@ describe('IDE commit form', () => {
});
});
});
describe
(
'
commitButtonText
'
,
()
=>
{
it
(
'
returns commit text when staged files exist
'
,
()
=>
{
vm
.
$store
.
state
.
stagedFiles
.
push
(
'
testing
'
);
expect
(
vm
.
commitButtonText
).
toBe
(
'
Commit
'
);
});
it
(
'
returns stage & commit text when staged files do not exist
'
,
()
=>
{
expect
(
vm
.
commitButtonText
).
toBe
(
'
Stage & Commit
'
);
});
});
});
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
View file @
c1b29823
...
...
@@ -114,4 +114,19 @@ describe('IDE commit sidebar radio group', () => {
});
});
});
describe
(
'
tooltipTitle
'
,
()
=>
{
it
(
'
returns title when disabled
'
,
()
=>
{
vm
.
title
=
'
test title
'
;
vm
.
disabled
=
true
;
expect
(
vm
.
tooltipTitle
).
toBe
(
'
test title
'
);
});
it
(
'
returns blank when not disabled
'
,
()
=>
{
vm
.
title
=
'
test title
'
;
expect
(
vm
.
tooltipTitle
).
not
.
toBe
(
'
test title
'
);
});
});
});
spec/javascripts/ide/stores/getters_spec.js
View file @
c1b29823
...
...
@@ -160,4 +160,23 @@ describe('IDE store getters', () => {
expect
(
getters
.
lastCommit
(
localState
,
localGetters
).
title
).
toBe
(
commitTitle
);
});
});
describe
(
'
currentBranch
'
,
()
=>
{
it
(
'
returns current projects branch
'
,
()
=>
{
const
localGetters
=
{
currentProject
:
{
branches
:
{
master
:
{
name
:
'
master
'
,
},
},
},
};
localState
.
currentBranchId
=
'
master
'
;
expect
(
getters
.
currentBranch
(
localState
,
localGetters
)).
toEqual
({
name
:
'
master
'
,
});
});
});
});
spec/javascripts/ide/stores/utils_spec.js
View file @
c1b29823
...
...
@@ -94,6 +94,7 @@ describe('Multi-file store utils', () => {
newBranch
:
false
,
state
,
rootState
,
getters
:
{},
});
expect
(
payload
).
toEqual
({
...
...
@@ -118,5 +119,58 @@ describe('Multi-file store utils', () => {
start_branch
:
undefined
,
});
});
it
(
'
uses prebuilt commit message when commit message is empty
'
,
()
=>
{
const
rootState
=
{
stagedFiles
:
[
{
...
file
(
'
staged
'
),
path
:
'
staged
'
,
content
:
'
updated file content
'
,
lastCommitSha
:
'
123456789
'
,
},
{
...
file
(
'
newFile
'
),
path
:
'
added
'
,
tempFile
:
true
,
content
:
'
new file content
'
,
base64
:
true
,
lastCommitSha
:
'
123456789
'
,
},
],
currentBranchId
:
'
master
'
,
};
const
payload
=
utils
.
createCommitPayload
({
branch
:
'
master
'
,
newBranch
:
false
,
state
:
{},
rootState
,
getters
:
{
preBuiltCommitMessage
:
'
prebuilt test commit message
'
,
},
});
expect
(
payload
).
toEqual
({
branch
:
'
master
'
,
commit_message
:
'
prebuilt test commit message
'
,
actions
:
[
{
action
:
'
update
'
,
file_path
:
'
staged
'
,
content
:
'
updated file content
'
,
encoding
:
'
text
'
,
last_commit_id
:
'
123456789
'
,
},
{
action
:
'
create
'
,
file_path
:
'
added
'
,
content
:
'
new file content
'
,
encoding
:
'
base64
'
,
last_commit_id
:
'
123456789
'
,
},
],
start_branch
:
undefined
,
});
});
});
});
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