mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
remove modal box if redeem a redeemlink
This commit is contained in:
parent
9c7506f20c
commit
e3e5fdd12b
@ -3,7 +3,7 @@
|
||||
<redeem-information v-bind="linkData" :isContributionLink="isContributionLink" />
|
||||
<b-jumbotron>
|
||||
<div class="mb-3 text-center">
|
||||
<b-button variant="primary" @click="$emit('redeem-link', linkData.amount)" size="lg">
|
||||
<b-button variant="primary" @click="$emit('mutation-link', linkData.amount)" size="lg">
|
||||
{{ $t('gdd_per_link.redeem') }}
|
||||
</b-button>
|
||||
</div>
|
||||
|
||||
@ -282,18 +282,18 @@ describe('TransactionLink', () => {
|
||||
})
|
||||
|
||||
describe('redeem link with success', () => {
|
||||
let spy
|
||||
// let spy
|
||||
|
||||
beforeEach(async () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
// spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
apolloMutateMock.mockResolvedValue()
|
||||
spy.mockImplementation(() => Promise.resolve(true))
|
||||
// spy.mockImplementation(() => Promise.resolve(true))
|
||||
await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click')
|
||||
})
|
||||
|
||||
it('opens the modal', () => {
|
||||
expect(spy).toBeCalledWith('gdd_per_link.redeem-text')
|
||||
})
|
||||
// it('opens the modal', () => {
|
||||
// expect(spy).toBeCalledWith('gdd_per_link.redeem-text')
|
||||
// })
|
||||
|
||||
it('calls the API', () => {
|
||||
expect(apolloMutateMock).toBeCalledWith(
|
||||
@ -316,37 +316,37 @@ describe('TransactionLink', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('cancel redeem link', () => {
|
||||
let spy
|
||||
// describe('cancel redeem link', () => {
|
||||
// let spy
|
||||
|
||||
beforeEach(async () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
apolloMutateMock.mockResolvedValue()
|
||||
spy.mockImplementation(() => Promise.resolve(false))
|
||||
await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click')
|
||||
})
|
||||
// beforeEach(async () => {
|
||||
// spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
// apolloMutateMock.mockResolvedValue()
|
||||
// spy.mockImplementation(() => Promise.resolve(false))
|
||||
// await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click')
|
||||
// })
|
||||
|
||||
it('does not call the API', () => {
|
||||
expect(apolloMutateMock).not.toBeCalled()
|
||||
})
|
||||
// it('does not call the API', () => {
|
||||
// expect(apolloMutateMock).not.toBeCalled()
|
||||
// })
|
||||
|
||||
it('does not toasts a success message', () => {
|
||||
expect(mocks.$t).not.toBeCalledWith('gdd_per_link.redeemed', { n: '22' })
|
||||
expect(toastSuccessSpy).not.toBeCalled()
|
||||
})
|
||||
// it('does not toasts a success message', () => {
|
||||
// expect(mocks.$t).not.toBeCalledWith('gdd_per_link.redeemed', { n: '22' })
|
||||
// expect(toastSuccessSpy).not.toBeCalled()
|
||||
// })
|
||||
|
||||
it('does not push the route', () => {
|
||||
expect(routerPushMock).not.toBeCalled()
|
||||
})
|
||||
})
|
||||
// it('does not push the route', () => {
|
||||
// expect(routerPushMock).not.toBeCalled()
|
||||
// })
|
||||
// })
|
||||
|
||||
describe('redeem link with error', () => {
|
||||
let spy
|
||||
// let spy
|
||||
|
||||
beforeEach(async () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
// spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
apolloMutateMock.mockRejectedValue({ message: 'Oh Noo!' })
|
||||
spy.mockImplementation(() => Promise.resolve(true))
|
||||
// spy.mockImplementation(() => Promise.resolve(true))
|
||||
await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click')
|
||||
})
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<redeem-valid
|
||||
:linkData="linkData"
|
||||
:isContributionLink="isContributionLink"
|
||||
@redeem-link="redeemLink"
|
||||
@mutation-link="mutationLink"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -98,11 +98,6 @@ export default {
|
||||
this.$router.push('/overview')
|
||||
})
|
||||
},
|
||||
redeemLink(amount) {
|
||||
this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.redeem-text')).then((value) => {
|
||||
if (value) this.mutationLink(amount)
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
isContributionLink() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user