diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 12:09:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 12:09:22 +0000 |
commit | 286fe61013674fe2d245ffc8d2233baf09923e70 (patch) | |
tree | 2037291f5863105e54e75be056b49f7d62007cae /spec/frontend/ide/components | |
parent | 4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4 (diff) | |
download | gitlab-ce-286fe61013674fe2d245ffc8d2233baf09923e70.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ide/components')
-rw-r--r-- | spec/frontend/ide/components/commit_sidebar/editor_header_spec.js | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js index 054e7492429..a25aba61516 100644 --- a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js @@ -14,7 +14,6 @@ describe('IDE commit editor header', () => { const findDiscardModal = () => wrapper.find({ ref: 'discardModal' }); const findDiscardButton = () => wrapper.find({ ref: 'discardButton' }); - const findActionButton = () => wrapper.find({ ref: 'actionButton' }); beforeEach(() => { f = file('file'); @@ -28,9 +27,7 @@ describe('IDE commit editor header', () => { }, }); - jest.spyOn(wrapper.vm, 'stageChange').mockImplementation(); - jest.spyOn(wrapper.vm, 'unstageChange').mockImplementation(); - jest.spyOn(wrapper.vm, 'discardFileChanges').mockImplementation(); + jest.spyOn(wrapper.vm, 'discardChanges').mockImplementation(); }); afterEach(() => { @@ -38,8 +35,8 @@ describe('IDE commit editor header', () => { wrapper = null; }); - it('renders button to discard & stage', () => { - expect(wrapper.vm.$el.querySelectorAll('.btn').length).toBe(2); + it('renders button to discard', () => { + expect(wrapper.vm.$el.querySelectorAll('.btn')).toHaveLength(1); }); describe('discard button', () => { @@ -60,23 +57,7 @@ describe('IDE commit editor header', () => { it('calls discardFileChanges if dialog result is confirmed', () => { modal.vm.$emit('ok'); - expect(wrapper.vm.discardFileChanges).toHaveBeenCalledWith(f.path); - }); - }); - - describe('stage/unstage button', () => { - it('unstages the file if it was already staged', () => { - f.staged = true; - - findActionButton().trigger('click'); - - expect(wrapper.vm.unstageChange).toHaveBeenCalledWith(f.path); - }); - - it('stages the file if it was not staged', () => { - findActionButton().trigger('click'); - - expect(wrapper.vm.stageChange).toHaveBeenCalledWith(f.path); + expect(wrapper.vm.discardChanges).toHaveBeenCalledWith(f.path); }); }); }); |