diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 06:14:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 06:14:30 +0300 |
commit | 88f4a8a8caf198412f4914753ff4476a2e92feb2 (patch) | |
tree | 0bee3afd56f4b63a2c39ac84d3e45acad9e0339d /spec/frontend/repository | |
parent | 085915bb89ae564f556ec326bc161ebf93f6466b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/repository')
-rw-r--r-- | spec/frontend/repository/components/upload_blob_modal_spec.js | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/spec/frontend/repository/components/upload_blob_modal_spec.js b/spec/frontend/repository/components/upload_blob_modal_spec.js index f7c31f91cd7..319321cfcb4 100644 --- a/spec/frontend/repository/components/upload_blob_modal_spec.js +++ b/spec/frontend/repository/components/upload_blob_modal_spec.js @@ -105,9 +105,7 @@ describe('UploadBlobModal', () => { if (canPushCode) { describe('when changing the branch name', () => { it('displays the MR toggle', async () => { - // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details - // eslint-disable-next-line no-restricted-syntax - wrapper.setData({ target: 'Not main' }); + createComponent({ targetBranch: 'Not main' }); await nextTick(); @@ -118,12 +116,10 @@ describe('UploadBlobModal', () => { describe('completed form', () => { beforeEach(() => { - // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details - // eslint-disable-next-line no-restricted-syntax - wrapper.setData({ - file: { type: 'jpg' }, - filePreviewURL: 'http://file.com?format=jpg', - }); + findUploadDropzone().vm.$emit( + 'change', + new File(['http://file.com?format=jpg'], 'file.jpg'), + ); }); it('enables the upload button when the form is completed', () => { @@ -194,13 +190,6 @@ describe('UploadBlobModal', () => { ); describe('blob file submission type', () => { - const submitForm = async () => { - wrapper.vm.uploadFile = jest.fn(); - wrapper.vm.replaceFile = jest.fn(); - wrapper.vm.submitForm(); - await nextTick(); - }; - const submitRequest = async () => { mock = new MockAdapter(axios); findModal().vm.$emit('primary', mockEvent); @@ -220,13 +209,6 @@ describe('UploadBlobModal', () => { expect(findModal().props('actionPrimary').text).toBe('Upload file'); }); - it('calls the default uploadFile when the form submit', async () => { - await submitForm(); - - expect(wrapper.vm.uploadFile).toHaveBeenCalled(); - expect(wrapper.vm.replaceFile).not.toHaveBeenCalled(); - }); - it('makes a POST request', async () => { await submitRequest(); @@ -256,13 +238,6 @@ describe('UploadBlobModal', () => { expect(findModal().props('actionPrimary').text).toBe(primaryBtnText); }); - it('calls the replaceFile when the form submit', async () => { - await submitForm(); - - expect(wrapper.vm.replaceFile).toHaveBeenCalled(); - expect(wrapper.vm.uploadFile).not.toHaveBeenCalled(); - }); - it('makes a PUT request', async () => { await submitRequest(); |