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
5b2574d0
Commit
5b2574d0
authored
Feb 08, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed failing specs
added more specs
parent
c194d4ac
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
2 deletions
+42
-2
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+2
-0
app/assets/javascripts/ide/stores/mutation_types.js
app/assets/javascripts/ide/stores/mutation_types.js
+1
-0
app/assets/javascripts/ide/stores/mutations/tree.js
app/assets/javascripts/ide/stores/mutations/tree.js
+5
-0
spec/javascripts/repo/stores/actions_spec.js
spec/javascripts/repo/stores/actions_spec.js
+24
-2
spec/javascripts/repo/stores/mutations/tree_spec.js
spec/javascripts/repo/stores/mutations/tree_spec.js
+10
-0
No files found.
app/assets/javascripts/ide/stores/actions.js
View file @
5b2574d0
...
...
@@ -18,6 +18,8 @@ export const discardAllChanges = ({ state, commit, dispatch }) => {
dispatch
(
'
closeFile
'
,
file
);
}
});
commit
(
types
.
REMOVE_ALL_CHANGES_FILES
);
};
export
const
closeAllFiles
=
({
state
,
dispatch
})
=>
{
...
...
app/assets/javascripts/ide/stores/mutation_types.js
View file @
5b2574d0
...
...
@@ -24,6 +24,7 @@ export const TOGGLE_TREE_OPEN = 'TOGGLE_TREE_OPEN';
export
const
CREATE_TMP_TREE
=
'
CREATE_TMP_TREE
'
;
export
const
SET_LAST_COMMIT_URL
=
'
SET_LAST_COMMIT_URL
'
;
export
const
CREATE_TREE
=
'
CREATE_TREE
'
;
export
const
REMOVE_ALL_CHANGES_FILES
=
'
REMOVE_ALL_CHANGES_FILES
'
;
// File mutation types
export
const
SET_FILE_DATA
=
'
SET_FILE_DATA
'
;
...
...
app/assets/javascripts/ide/stores/mutations/tree.js
View file @
5b2574d0
...
...
@@ -33,4 +33,9 @@ export default {
[
types
.
CREATE_TMP_TREE
](
state
,
{
parent
,
tmpEntry
})
{
parent
.
tree
.
push
(
tmpEntry
);
},
[
types
.
REMOVE_ALL_CHANGES_FILES
](
state
)
{
Object
.
assign
(
state
,
{
changedFiles
:
[],
});
},
};
spec/javascripts/repo/stores/actions_spec.js
View file @
5b2574d0
...
...
@@ -36,8 +36,30 @@ describe('Multi-file store actions', () => {
describe
(
'
discardAllChanges
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
openFiles
.
push
(
file
(
'
discardAll
'
));
store
.
state
.
openFiles
[
0
].
changed
=
true
;
const
f
=
file
(
'
discardAll
'
);
f
.
changed
=
true
;
store
.
state
.
openFiles
.
push
(
f
);
store
.
state
.
changedFiles
.
push
(
f
);
});
it
(
'
discards changes in file
'
,
(
done
)
=>
{
store
.
dispatch
(
'
discardAllChanges
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
openFiles
.
changed
).
toBeFalsy
();
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
removes all files from changedFiles state
'
,
(
done
)
=>
{
store
.
dispatch
(
'
discardAllChanges
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
changedFiles
.
length
).
toBe
(
0
);
expect
(
store
.
state
.
openFiles
.
length
).
toBe
(
1
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
...
...
spec/javascripts/repo/stores/mutations/tree_spec.js
View file @
5b2574d0
...
...
@@ -68,4 +68,14 @@ describe('Multi-file store tree mutations', () => {
expect
(
localTree
.
tree
[
0
].
name
).
toBe
(
tmpEntry
.
name
);
});
});
describe
(
'
REMOVE_ALL_CHANGES_FILES
'
,
()
=>
{
it
(
'
removes all files from changedFiles state
'
,
()
=>
{
localState
.
changedFiles
.
push
(
file
(
'
REMOVE_ALL_CHANGES_FILES
'
));
mutations
.
REMOVE_ALL_CHANGES_FILES
(
localState
);
expect
(
localState
.
changedFiles
.
length
).
toBe
(
0
);
});
});
});
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