diff options
Diffstat (limited to 'spec/javascripts/ide')
-rw-r--r-- | spec/javascripts/ide/components/commit_sidebar/form_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/ide/components/file_row_extra_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/ide/stores/actions_spec.js | 101 |
3 files changed, 16 insertions, 89 deletions
diff --git a/spec/javascripts/ide/components/commit_sidebar/form_spec.js b/spec/javascripts/ide/components/commit_sidebar/form_spec.js index e984389bd46..9ee0cbdd3d4 100644 --- a/spec/javascripts/ide/components/commit_sidebar/form_spec.js +++ b/spec/javascripts/ide/components/commit_sidebar/form_spec.js @@ -52,7 +52,7 @@ describe('IDE commit form', () => { vm.$store.state.stagedFiles.push('test'); vm.$nextTick(() => { - expect(vm.$el.querySelector('p').textContent).toContain('1 unstaged and 1 staged changes'); + expect(vm.$el.querySelector('p').textContent).toContain('1 staged and 1 unstaged changes'); done(); }); }); diff --git a/spec/javascripts/ide/components/file_row_extra_spec.js b/spec/javascripts/ide/components/file_row_extra_spec.js index 4c2f29f55dd..f498d8251c8 100644 --- a/spec/javascripts/ide/components/file_row_extra_spec.js +++ b/spec/javascripts/ide/components/file_row_extra_spec.js @@ -63,7 +63,7 @@ describe('IDE extra file row component', () => { stagedFilesCount = 1; unstagedFilesCount = 1; - expect(vm.folderChangesTooltip).toBe('1 unstaged and 1 staged changes'); + expect(vm.folderChangesTooltip).toBe('1 staged and 1 unstaged changes'); }); }); diff --git a/spec/javascripts/ide/stores/actions_spec.js b/spec/javascripts/ide/stores/actions_spec.js index 4e65a7b0673..364c8421b6b 100644 --- a/spec/javascripts/ide/stores/actions_spec.js +++ b/spec/javascripts/ide/stores/actions_spec.js @@ -225,35 +225,6 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - describe('when `gon.feature.stageAllByDefault` is true', () => { - const originalGonFeatures = Object.assign({}, gon.features); - - beforeAll(() => { - gon.features = { stageAllByDefault: true }; - }); - - afterAll(() => { - gon.features = originalGonFeatures; - }); - - it('adds tmp file to staged files', done => { - const name = 'test'; - - store - .dispatch('createTempEntry', { - name, - branchId: 'mybranch', - type: 'blob', - }) - .then(() => { - expect(store.state.stagedFiles).toEqual([jasmine.objectContaining({ name })]); - - done(); - }) - .catch(done.fail); - }); - }); - it('adds tmp file to open files', done => { const name = 'test'; @@ -274,7 +245,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('adds tmp file to changed files', done => { + it('adds tmp file to staged files', done => { const name = 'test'; store @@ -284,9 +255,7 @@ describe('Multi-file store actions', () => { type: 'blob', }) .then(() => { - expect(store.state.changedFiles).toEqual([ - jasmine.objectContaining({ name, tempFile: true }), - ]); + expect(store.state.stagedFiles).toEqual([jasmine.objectContaining({ name })]); done(); }) @@ -294,15 +263,9 @@ describe('Multi-file store actions', () => { }); it('sets tmp file as active', () => { - const dispatch = jasmine.createSpy(); - const commit = jasmine.createSpy(); - - createTempEntry( - { state: store.state, getters: store.getters, dispatch, commit }, - { name: 'test', branchId: 'mybranch', type: 'blob' }, - ); + createTempEntry(store, { name: 'test', branchId: 'mybranch', type: 'blob' }); - expect(dispatch).toHaveBeenCalledWith('setFileActive', 'test'); + expect(store.dispatch).toHaveBeenCalledWith('setFileActive', 'test'); }); it('creates flash message if file already exists', done => { @@ -804,55 +767,19 @@ describe('Multi-file store actions', () => { }); }); - describe('when `gon.feature.stageAllByDefault` is true', () => { - const originalGonFeatures = Object.assign({}, gon.features); - - beforeAll(() => { - gon.features = { stageAllByDefault: true }; - }); - - afterAll(() => { - gon.features = originalGonFeatures; - }); - - it('by default renames an entry and stages it', () => { - const dispatch = jasmine.createSpy(); - const commit = jasmine.createSpy(); - - renameEntry( - { dispatch, commit, state: store.state, getters: store.getters }, - { path: 'orig', name: 'renamed' }, - ); - - expect(commit.calls.allArgs()).toEqual([ - [types.RENAME_ENTRY, { path: 'orig', name: 'renamed', parentPath: undefined }], - [types.STAGE_CHANGE, jasmine.objectContaining({ path: 'renamed' })], - ]); - }); - }); + it('by default renames an entry and stages it', () => { + const dispatch = jasmine.createSpy(); + const commit = jasmine.createSpy(); - it('by default renames an entry and adds to changed', done => { - testAction( - renameEntry, + renameEntry( + { dispatch, commit, state: store.state, getters: store.getters }, { path: 'orig', name: 'renamed' }, - store.state, - [ - { - type: types.RENAME_ENTRY, - payload: { - path: 'orig', - name: 'renamed', - parentPath: undefined, - }, - }, - { - type: types.ADD_FILE_TO_CHANGED, - payload: 'renamed', - }, - ], - jasmine.any(Object), - done, ); + + expect(commit.calls.allArgs()).toEqual([ + [types.RENAME_ENTRY, { path: 'orig', name: 'renamed', parentPath: undefined }], + [types.STAGE_CHANGE, jasmine.objectContaining({ path: 'renamed' })], + ]); }); it('if not changed, completely unstages and discards entry if renamed to original', done => { |