summaryrefslogtreecommitdiff
path: root/spec/javascripts/ide
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 15:08:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 15:08:15 +0000
commitc2b98d3dbd47ab92c79c702276fe9130d9a28036 (patch)
treebf4071f551fdc12c22b23b2bb66483064e7b9ea9 /spec/javascripts/ide
parentbadb9c1deacbea601b02f88811b7e123589d9251 (diff)
downloadgitlab-ce-c2b98d3dbd47ab92c79c702276fe9130d9a28036.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/ide')
-rw-r--r--spec/javascripts/ide/stores/actions_spec.js42
1 files changed, 37 insertions, 5 deletions
diff --git a/spec/javascripts/ide/stores/actions_spec.js b/spec/javascripts/ide/stores/actions_spec.js
index 708c5ea75e0..0ee114cb70d 100644
--- a/spec/javascripts/ide/stores/actions_spec.js
+++ b/spec/javascripts/ide/stores/actions_spec.js
@@ -92,26 +92,58 @@ describe('Multi-file store actions', () => {
.catch(done.fail);
});
- it('closes the temp file if it was open', done => {
+ it('closes the temp file and deletes it if it was open', done => {
f.tempFile = true;
testAction(
discardAllChanges,
undefined,
store.state,
+ [{ type: types.REMOVE_ALL_CHANGES_FILES }],
[
- { type: types.DISCARD_FILE_CHANGES, payload: 'discardAll' },
- { type: types.REMOVE_ALL_CHANGES_FILES },
+ { type: 'closeFile', payload: jasmine.objectContaining({ path: 'discardAll' }) },
+ { type: 'deleteEntry', payload: 'discardAll' },
],
+ done,
+ );
+ });
+
+ it('renames the file to its original name and closes it if it was open', done => {
+ Object.assign(f, {
+ prevPath: 'parent/path/old_name',
+ prevName: 'old_name',
+ prevParentPath: 'parent/path',
+ });
+
+ testAction(
+ discardAllChanges,
+ undefined,
+ store.state,
+ [{ type: types.REMOVE_ALL_CHANGES_FILES }],
[
+ { type: 'closeFile', payload: jasmine.objectContaining({ path: 'discardAll' }) },
{
- type: 'closeFile',
- payload: jasmine.objectContaining({ path: 'discardAll' }),
+ type: 'renameEntry',
+ payload: { path: 'discardAll', name: 'old_name', parentPath: 'parent/path' },
},
],
done,
);
});
+
+ it('discards file changes on all other files', done => {
+ testAction(
+ discardAllChanges,
+ undefined,
+ store.state,
+ [
+ { type: types.DISCARD_FILE_CHANGES, payload: 'discardAll' },
+ { type: types.REMOVE_ALL_CHANGES_FILES },
+ ],
+ [],
+ done,
+ );
+ });
});
describe('closeAllFiles', () => {