From 371bfba0eef49223c115252cca5c30c2437e7b83 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 3 Mar 2022 12:31:08 +0100 Subject: [PATCH] bv toast in edit creation formular --- admin/src/components/EditCreationFormular.spec.js | 11 +++-------- admin/src/components/EditCreationFormular.vue | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/admin/src/components/EditCreationFormular.spec.js b/admin/src/components/EditCreationFormular.spec.js index 84d3e26d3..f5c7fb0fe 100644 --- a/admin/src/components/EditCreationFormular.spec.js +++ b/admin/src/components/EditCreationFormular.spec.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils' import EditCreationFormular from './EditCreationFormular.vue' +import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue @@ -16,8 +17,6 @@ const apolloMutateMock = jest.fn().mockResolvedValue({ }) const stateCommitMock = jest.fn() -const toastedErrorMock = jest.fn() -const toastedSuccessMock = jest.fn() const mocks = { $t: jest.fn((t) => t), @@ -37,10 +36,6 @@ const mocks = { }, commit: stateCommitMock, }, - $toasted: { - error: toastedErrorMock, - success: toastedSuccessMock, - }, } const now = new Date(Date.now()) @@ -142,7 +137,7 @@ describe('EditCreationFormular', () => { }) it('toasts a success message', () => { - expect(toastedSuccessMock).toBeCalledWith('creation_form.toasted_update') + expect(toastSuccessSpy).toBeCalledWith('creation_form.toasted_update') }) }) @@ -155,7 +150,7 @@ describe('EditCreationFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Oh no!') + expect(toastErrorSpy).toBeCalledWith('Oh no!') }) }) }) diff --git a/admin/src/components/EditCreationFormular.vue b/admin/src/components/EditCreationFormular.vue index 650b00410..82b444154 100644 --- a/admin/src/components/EditCreationFormular.vue +++ b/admin/src/components/EditCreationFormular.vue @@ -132,7 +132,7 @@ export default { moderator: Number(result.data.updatePendingCreation.moderator), row: this.row, }) - this.$toasted.success( + this.toastSuccess( this.$t('creation_form.toasted_update', { value: this.value, email: this.item.email, @@ -144,7 +144,7 @@ export default { this.value = 0 }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) // das creation Formular reseten this.$refs.updateCreationForm.reset() // Den geschöpften Wert auf o setzen