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
4880caa1
Commit
4880caa1
authored
Apr 24, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
f0d861e6
d056d9d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
15 deletions
+26
-15
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+7
-0
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+6
-4
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+3
-2
spec/javascripts/ide/stores/utils_spec.js
spec/javascripts/ide/stores/utils_spec.js
+10
-9
No files found.
app/assets/javascripts/ide/constants.js
View file @
4880caa1
...
...
@@ -72,4 +72,11 @@ export const modalTypes = {
tree
:
'
tree
'
,
};
export
const
commitActionTypes
=
{
move
:
'
move
'
,
delete
:
'
delete
'
,
create
:
'
create
'
,
update
:
'
update
'
,
};
export
const
packageJsonPath
=
'
package.json
'
;
app/assets/javascripts/ide/stores/utils.js
View file @
4880caa1
import
{
commitActionTypes
}
from
'
../constants
'
;
export
const
dataStructure
=
()
=>
({
id
:
''
,
// Key will contain a mixture of ID and path
...
...
@@ -114,14 +116,14 @@ export const setPageTitle = title => {
export
const
commitActionForFile
=
file
=>
{
if
(
file
.
prevPath
)
{
return
'
move
'
;
return
commitActionTypes
.
move
;
}
else
if
(
file
.
deleted
)
{
return
'
delete
'
;
return
commitActionTypes
.
delete
;
}
else
if
(
file
.
tempFile
)
{
return
'
create
'
;
return
commitActionTypes
.
create
;
}
return
'
update
'
;
return
commitActionTypes
.
update
;
};
export
const
getCommitFiles
=
stagedFiles
=>
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
4880caa1
...
...
@@ -4,6 +4,7 @@ import service from '~/ide/services';
import
router
from
'
~/ide/ide_router
'
;
import
eventHub
from
'
~/ide/eventhub
'
;
import
consts
from
'
~/ide/stores/modules/commit/constants
'
;
import
{
commitActionTypes
}
from
'
~/ide/constants
'
;
import
{
resetStore
,
file
}
from
'
spec/ide/helpers
'
;
describe
(
'
IDE commit module actions
'
,
()
=>
{
...
...
@@ -294,7 +295,7 @@ describe('IDE commit module actions', () => {
commit_message
:
'
testing 123
'
,
actions
:
[
{
action
:
'
update
'
,
action
:
commitActionTypes
.
update
,
file_path
:
jasmine
.
anything
(),
content
:
undefined
,
encoding
:
jasmine
.
anything
(),
...
...
@@ -321,7 +322,7 @@ describe('IDE commit module actions', () => {
commit_message
:
'
testing 123
'
,
actions
:
[
{
action
:
'
update
'
,
action
:
commitActionTypes
.
update
,
file_path
:
jasmine
.
anything
(),
content
:
undefined
,
encoding
:
jasmine
.
anything
(),
...
...
spec/javascripts/ide/stores/utils_spec.js
View file @
4880caa1
import
*
as
utils
from
'
~/ide/stores/utils
'
;
import
{
commitActionTypes
}
from
'
~/ide/constants
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
Multi-file store utils
'
,
()
=>
{
...
...
@@ -107,7 +108,7 @@ describe('Multi-file store utils', () => {
commit_message
:
'
commit message
'
,
actions
:
[
{
action
:
'
update
'
,
action
:
commitActionTypes
.
update
,
file_path
:
'
staged
'
,
content
:
'
updated file content
'
,
encoding
:
'
text
'
,
...
...
@@ -115,7 +116,7 @@ describe('Multi-file store utils', () => {
previous_path
:
undefined
,
},
{
action
:
'
create
'
,
action
:
commitActionTypes
.
create
,
file_path
:
'
added
'
,
content
:
'
new file content
'
,
encoding
:
'
base64
'
,
...
...
@@ -123,7 +124,7 @@ describe('Multi-file store utils', () => {
previous_path
:
undefined
,
},
{
action
:
'
delete
'
,
action
:
commitActionTypes
.
delete
,
file_path
:
'
deletedFile
'
,
content
:
undefined
,
encoding
:
'
text
'
,
...
...
@@ -170,7 +171,7 @@ describe('Multi-file store utils', () => {
commit_message
:
'
prebuilt test commit message
'
,
actions
:
[
{
action
:
'
update
'
,
action
:
commitActionTypes
.
update
,
file_path
:
'
staged
'
,
content
:
'
updated file content
'
,
encoding
:
'
text
'
,
...
...
@@ -178,7 +179,7 @@ describe('Multi-file store utils', () => {
previous_path
:
undefined
,
},
{
action
:
'
create
'
,
action
:
commitActionTypes
.
create
,
file_path
:
'
added
'
,
content
:
'
new file content
'
,
encoding
:
'
base64
'
,
...
...
@@ -193,19 +194,19 @@ describe('Multi-file store utils', () => {
describe
(
'
commitActionForFile
'
,
()
=>
{
it
(
'
returns deleted for deleted file
'
,
()
=>
{
expect
(
utils
.
commitActionForFile
({
deleted
:
true
})).
toBe
(
'
delete
'
);
expect
(
utils
.
commitActionForFile
({
deleted
:
true
})).
toBe
(
commitActionTypes
.
delete
);
});
it
(
'
returns create for tempFile
'
,
()
=>
{
expect
(
utils
.
commitActionForFile
({
tempFile
:
true
})).
toBe
(
'
create
'
);
expect
(
utils
.
commitActionForFile
({
tempFile
:
true
})).
toBe
(
commitActionTypes
.
create
);
});
it
(
'
returns move for moved file
'
,
()
=>
{
expect
(
utils
.
commitActionForFile
({
prevPath
:
'
test
'
})).
toBe
(
'
move
'
);
expect
(
utils
.
commitActionForFile
({
prevPath
:
'
test
'
})).
toBe
(
commitActionTypes
.
move
);
});
it
(
'
returns update by default
'
,
()
=>
{
expect
(
utils
.
commitActionForFile
({})).
toBe
(
'
update
'
);
expect
(
utils
.
commitActionForFile
({})).
toBe
(
commitActionTypes
.
update
);
});
});
...
...
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