diff options
Diffstat (limited to 'spec/frontend/ide')
11 files changed, 24 insertions, 25 deletions
diff --git a/spec/frontend/ide/components/branches/search_list_spec.js b/spec/frontend/ide/components/branches/search_list_spec.js index d26dfc48ff8..fe142d70698 100644 --- a/spec/frontend/ide/components/branches/search_list_spec.js +++ b/spec/frontend/ide/components/branches/search_list_spec.js @@ -33,7 +33,6 @@ describe('IDE branches search list', () => { wrapper = shallowMount(List, { localVue, store: fakeStore, - sync: false, }); }; 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 ad69984fd35..054e7492429 100644 --- a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js @@ -23,7 +23,6 @@ describe('IDE commit editor header', () => { wrapper = mount(EditorHeader, { store, localVue, - sync: false, propsData: { activeFile: f, }, diff --git a/spec/frontend/ide/components/error_message_spec.js b/spec/frontend/ide/components/error_message_spec.js index db29413af24..1de496ba3f8 100644 --- a/spec/frontend/ide/components/error_message_spec.js +++ b/spec/frontend/ide/components/error_message_spec.js @@ -26,7 +26,6 @@ describe('IDE error message component', () => { }, store: fakeStore, localVue, - sync: false, }); }; diff --git a/spec/frontend/ide/components/file_templates/dropdown_spec.js b/spec/frontend/ide/components/file_templates/dropdown_spec.js index e107d3a364f..3cffbc3362f 100644 --- a/spec/frontend/ide/components/file_templates/dropdown_spec.js +++ b/spec/frontend/ide/components/file_templates/dropdown_spec.js @@ -45,7 +45,6 @@ describe('IDE file templates dropdown component', () => { }, store: fakeStore, localVue, - sync: false, }); ({ element } = wrapper); diff --git a/spec/frontend/ide/components/ide_status_list_spec.js b/spec/frontend/ide/components/ide_status_list_spec.js index e0574450101..2762adfb57d 100644 --- a/spec/frontend/ide/components/ide_status_list_spec.js +++ b/spec/frontend/ide/components/ide_status_list_spec.js @@ -27,7 +27,6 @@ describe('ide/components/ide_status_list', () => { wrapper = shallowMount(IdeStatusList, { localVue, - sync: false, store, ...options, }); diff --git a/spec/frontend/ide/components/jobs/list_spec.js b/spec/frontend/ide/components/jobs/list_spec.js index ec2e5b05048..d8880fa7cb7 100644 --- a/spec/frontend/ide/components/jobs/list_spec.js +++ b/spec/frontend/ide/components/jobs/list_spec.js @@ -44,7 +44,6 @@ describe('IDE stages list', () => { }, localVue, store, - sync: false, }); }; @@ -93,7 +92,6 @@ describe('IDE stages list', () => { wrapper = mount(StageList, { propsData: { ...defaultProps, stages }, store, - sync: false, localVue, }); }); diff --git a/spec/frontend/ide/components/jobs/stage_spec.js b/spec/frontend/ide/components/jobs/stage_spec.js index 400eabfee6d..3a47571ee13 100644 --- a/spec/frontend/ide/components/jobs/stage_spec.js +++ b/spec/frontend/ide/components/jobs/stage_spec.js @@ -26,7 +26,6 @@ describe('IDE pipeline stage', () => { ...defaultProps, ...props, }, - sync: false, }); }; diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js index 76806dcba69..ae94ee4efa7 100644 --- a/spec/frontend/ide/components/merge_requests/list_spec.js +++ b/spec/frontend/ide/components/merge_requests/list_spec.js @@ -42,7 +42,6 @@ describe('IDE merge requests list', () => { wrapper = shallowMount(List, { store: fakeStore, localVue, - sync: false, }); }; diff --git a/spec/frontend/ide/components/pipelines/list_spec.js b/spec/frontend/ide/components/pipelines/list_spec.js index 91152dffafa..11e672b6685 100644 --- a/spec/frontend/ide/components/pipelines/list_spec.js +++ b/spec/frontend/ide/components/pipelines/list_spec.js @@ -63,7 +63,6 @@ describe('IDE pipelines list', () => { wrapper = shallowMount(List, { localVue, store: fakeStore, - sync: false, }); }; diff --git a/spec/frontend/ide/components/preview/clientside_spec.js b/spec/frontend/ide/components/preview/clientside_spec.js index 5cb9e598fc4..c7d5ea9c513 100644 --- a/spec/frontend/ide/components/preview/clientside_spec.js +++ b/spec/frontend/ide/components/preview/clientside_spec.js @@ -54,7 +54,6 @@ describe('IDE clientside preview', () => { }); wrapper = shallowMount(Clientside, { - sync: false, store, localVue, }); diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 4ec8f6b7dff..8ba7b554f43 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -9,6 +9,7 @@ import router from '~/ide/ide_router'; import eventHub from '~/ide/eventhub'; import { file } from '../../helpers'; +const ORIGINAL_CONTENT = 'original content'; const RELATIVE_URL_ROOT = '/gitlab'; describe('IDE store file actions', () => { @@ -583,6 +584,7 @@ describe('IDE store file actions', () => { tmpFile = file('tempFile'); tmpFile.content = 'testing'; + tmpFile.raw = ORIGINAL_CONTENT; store.state.changedFiles.push(tmpFile); store.state.entries[tmpFile.path] = tmpFile; @@ -594,7 +596,7 @@ describe('IDE store file actions', () => { store .dispatch('discardFileChanges', tmpFile.path) .then(() => { - expect(tmpFile.content).not.toBe('testing'); + expect(tmpFile.content).toBe(ORIGINAL_CONTENT); done(); }) @@ -624,22 +626,30 @@ describe('IDE store file actions', () => { expect(store.dispatch).toHaveBeenCalledWith('deleteEntry', tmpFile.path); }); - it('renames the file to its original name and closes it if it was open', () => { - Object.assign(tmpFile, { - prevPath: 'parentPath/old_name', - prevName: 'old_name', - prevParentPath: 'parentPath', - }); + describe('with renamed file', () => { + beforeEach(() => { + Object.assign(tmpFile, { + prevPath: 'parentPath/old_name', + prevName: 'old_name', + prevParentPath: 'parentPath', + }); - store.state.entries.parentPath = file('parentPath'); + store.state.entries.parentPath = file('parentPath'); - actions.discardFileChanges(store, tmpFile.path); + actions.discardFileChanges(store, tmpFile.path); + }); - expect(store.dispatch).toHaveBeenCalledWith('closeFile', tmpFile); - expect(store.dispatch).toHaveBeenCalledWith('renameEntry', { - path: 'tempFile', - name: 'old_name', - parentPath: 'parentPath', + it('renames the file to its original name and closes it if it was open', () => { + expect(store.dispatch).toHaveBeenCalledWith('closeFile', tmpFile); + expect(store.dispatch).toHaveBeenCalledWith('renameEntry', { + path: 'tempFile', + name: 'old_name', + parentPath: 'parentPath', + }); + }); + + it('resets file content', () => { + expect(tmpFile.content).toBe(ORIGINAL_CONTENT); }); }); |