bv toast in edit creation formular

This commit is contained in:
Moriz Wahl 2022-03-03 12:31:08 +01:00
parent bb4a237f18
commit 371bfba0ee
2 changed files with 5 additions and 10 deletions

View File

@ -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!')
})
})
})

View File

@ -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