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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3b091a9f
Commit
3b091a9f
authored
Feb 14, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started specs for commit module
parent
f9935aab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
1 deletion
+91
-1
app/assets/javascripts/ide/stores/modules/commit/getters.js
app/assets/javascripts/ide/stores/modules/commit/getters.js
+1
-1
spec/javascripts/repo/stores/modules/commit/getters_spec.js
spec/javascripts/repo/stores/modules/commit/getters_spec.js
+48
-0
spec/javascripts/repo/stores/modules/commit/mutations_spec.js
.../javascripts/repo/stores/modules/commit/mutations_spec.js
+42
-0
No files found.
app/assets/javascripts/ide/stores/modules/commit/getters.js
View file @
3b091a9f
...
...
@@ -5,7 +5,7 @@ export const discardDraftButtonDisabled = state => state.commitMessage === '' ||
export
const
commitButtonDisabled
=
(
state
,
getters
,
rootState
)
=>
getters
.
discardDraftButtonDisabled
||
!
rootState
.
changedFiles
.
length
;
export
const
newBranchName
=
(
state
,
getters
,
rootState
)
=>
export
const
newBranchName
=
(
state
,
_
,
rootState
)
=>
`
${
gon
.
current_username
}
-
${
rootState
.
currentBranchId
}
-patch-
${
`
${
new
Date
().
getTime
()}
`
.
substr
(
-
5
)}
`
;
export
const
branchName
=
(
state
,
getters
,
rootState
)
=>
{
...
...
spec/javascripts/repo/stores/modules/commit/getters_spec.js
0 → 100644
View file @
3b091a9f
import
commitState
from
'
~/ide/stores/modules/commit/state
'
;
import
*
as
getters
from
'
~/ide/stores/modules/commit/getters
'
;
describe
(
'
IDE commit module getters
'
,
()
=>
{
let
state
;
beforeEach
(()
=>
{
state
=
commitState
();
});
describe
(
'
discardDraftButtonDisabled
'
,
()
=>
{
it
(
'
returns true when commitMessage is empty
'
,
()
=>
{
expect
(
getters
.
discardDraftButtonDisabled
(
state
)).
toBeTruthy
();
});
it
(
'
returns false when commitMessage is not empty & loading is false
'
,
()
=>
{
state
.
commitMessage
=
'
test
'
;
state
.
submitCommitLoading
=
false
;
expect
(
getters
.
discardDraftButtonDisabled
(
state
)).
toBeFalsy
();
});
it
(
'
returns true when commitMessage is not empty & loading is true
'
,
()
=>
{
state
.
commitMessage
=
'
test
'
;
state
.
submitCommitLoading
=
true
;
expect
(
getters
.
discardDraftButtonDisabled
(
state
)).
toBeTruthy
();
});
});
describe
(
'
commitButtonDisabled
'
,
()
=>
{
});
describe
(
'
newBranchName
'
,
()
=>
{
it
(
'
includes username, currentBranchId, patch & random number
'
,
()
=>
{
gon
.
current_username
=
'
username
'
;
const
branch
=
getters
.
newBranchName
(
state
,
null
,
{
currentBranchId
:
'
testing
'
});
expect
(
branch
).
toMatch
(
/username-testing-patch-
\d{5}
$/
);
});
});
describe
(
'
branchName
'
,
()
=>
{
});
});
spec/javascripts/repo/stores/modules/commit/mutations_spec.js
0 → 100644
View file @
3b091a9f
import
commitState
from
'
~/ide/stores/modules/commit/state
'
;
import
mutations
from
'
~/ide/stores/modules/commit/mutations
'
;
describe
(
'
IDE commit module mutations
'
,
()
=>
{
let
state
;
beforeEach
(()
=>
{
state
=
commitState
();
});
describe
(
'
UPDATE_COMMIT_MESSAGE
'
,
()
=>
{
it
(
'
updates commitMessage
'
,
()
=>
{
mutations
.
UPDATE_COMMIT_MESSAGE
(
state
,
'
testing
'
);
expect
(
state
.
commitMessage
).
toBe
(
'
testing
'
);
});
});
describe
(
'
UPDATE_COMMIT_ACTION
'
,
()
=>
{
it
(
'
updates commitAction
'
,
()
=>
{
mutations
.
UPDATE_COMMIT_ACTION
(
state
,
'
testing
'
);
expect
(
state
.
commitAction
).
toBe
(
'
testing
'
);
});
});
describe
(
'
UPDATE_NEW_BRANCH_NAME
'
,
()
=>
{
it
(
'
updates newBranchName
'
,
()
=>
{
mutations
.
UPDATE_NEW_BRANCH_NAME
(
state
,
'
testing
'
);
expect
(
state
.
newBranchName
).
toBe
(
'
testing
'
);
});
});
describe
(
'
UPDATE_LOADING
'
,
()
=>
{
it
(
'
updates submitCommitLoading
'
,
()
=>
{
mutations
.
UPDATE_LOADING
(
state
,
true
);
expect
(
state
.
submitCommitLoading
).
toBeTruthy
();
});
});
});
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