Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-04-13 15:34:41 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-04-20 11:52:16 +0300
commitabe4e6ddfa77bff82f4e39b5f6c79784c699f51d (patch)
treec753daf3693a9af8c82ac035124a4b9fb395030f /spec
parent8e1a73f07baa54ec776936b09c904e963c0b94ce (diff)
Merge branch 'ide-mr-changes-alert-box' into 'master'
Remove confirm box when redirecting to new merge request form in IDE Closes #45326 See merge request gitlab-org/gitlab-ce!18362
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/ide/stores/modules/commit/actions_spec.js85
1 files changed, 44 insertions, 41 deletions
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
index 90ded940227..1946a0c547c 100644
--- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js
+++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
@@ -133,10 +133,7 @@ describe('IDE commit module actions', () => {
store
.dispatch('commit/checkCommitStatus')
.then(() => {
- expect(service.getBranchData).toHaveBeenCalledWith(
- 'abcproject',
- 'master',
- );
+ expect(service.getBranchData).toHaveBeenCalledWith('abcproject', 'master');
done();
})
@@ -230,9 +227,7 @@ describe('IDE commit module actions', () => {
branch,
})
.then(() => {
- expect(
- store.state.projects.abcproject.branches.master.workingReference,
- ).toBe(data.id);
+ expect(store.state.projects.abcproject.branches.master.workingReference).toBe(data.id);
})
.then(done)
.catch(done.fail);
@@ -317,26 +312,7 @@ describe('IDE commit module actions', () => {
branch,
})
.then(() => {
- expect(router.push).toHaveBeenCalledWith(
- `/project/abcproject/blob/master/${f.path}`,
- );
- })
- .then(done)
- .catch(done.fail);
- });
-
- it('resets stores commit actions', done => {
- store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH;
-
- store
- .dispatch('commit/updateFilesAfterCommit', {
- data,
- branch,
- })
- .then(() => {
- expect(store.state.commit.commitAction).not.toBe(
- consts.COMMIT_TO_NEW_BRANCH,
- );
+ expect(router.push).toHaveBeenCalledWith(`/project/abcproject/blob/master/${f.path}`);
})
.then(done)
.catch(done.fail);
@@ -448,33 +424,60 @@ describe('IDE commit module actions', () => {
store
.dispatch('commit/commitChanges')
.then(() => {
- expect(store.state.openFiles[0].lastCommit.message).toBe(
- 'test message',
- );
+ expect(store.state.openFiles[0].lastCommit.message).toBe('test message');
done();
})
.catch(done.fail);
});
- it('redirects to new merge request page', done => {
- spyOn(eventHub, '$on');
-
- store.state.commit.commitAction = '3';
+ it('resets stores commit actions', done => {
+ store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH;
store
.dispatch('commit/commitChanges')
.then(() => {
- expect(urlUtils.visitUrl).toHaveBeenCalledWith(
- `webUrl/merge_requests/new?merge_request[source_branch]=${
- store.getters['commit/newBranchName']
- }&merge_request[target_branch]=master`,
- );
-
- done();
+ expect(store.state.commit.commitAction).not.toBe(consts.COMMIT_TO_NEW_BRANCH);
})
+ .then(done)
.catch(done.fail);
});
+
+ describe('merge request', () => {
+ it('redirects to new merge request page', done => {
+ spyOn(eventHub, '$on');
+
+ store.state.commit.commitAction = '3';
+
+ store
+ .dispatch('commit/commitChanges')
+ .then(() => {
+ expect(urlUtils.visitUrl).toHaveBeenCalledWith(
+ `webUrl/merge_requests/new?merge_request[source_branch]=${
+ store.getters['commit/newBranchName']
+ }&merge_request[target_branch]=master`,
+ );
+
+ done();
+ })
+ .catch(done.fail);
+ });
+
+ it('resets changed files before redirecting', done => {
+ spyOn(eventHub, '$on');
+
+ store.state.commit.commitAction = '3';
+
+ store
+ .dispatch('commit/commitChanges')
+ .then(() => {
+ expect(store.state.changedFiles.length).toBe(0);
+
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
});
describe('failed', () => {