mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
We probably don't even need 'disabled' property
This commit is contained in:
parent
7efc56a227
commit
9eba745b83
@ -49,10 +49,6 @@ describe('ReportModal.vue', () => {
|
||||
it('loading false', () => {
|
||||
expect(Wrapper().vm.loading).toBe(false)
|
||||
})
|
||||
|
||||
it('disabled true', () => {
|
||||
expect(Wrapper().vm.disabled).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('given a user', () => {
|
||||
@ -94,14 +90,10 @@ describe('ReportModal.vue', () => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('is enabled', async () => {
|
||||
expect(wrapper.vm.disabled).toBe(false)
|
||||
})
|
||||
|
||||
describe('click cancel button', () => {
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.find('button.cancel').trigger('click')
|
||||
wrapper.find('button.cancel').trigger('click')
|
||||
})
|
||||
|
||||
it('emits close', () => {
|
||||
@ -114,24 +106,20 @@ describe('ReportModal.vue', () => {
|
||||
})
|
||||
|
||||
describe('click confirm button', () => {
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers()
|
||||
await wrapper.find('button.confirm').trigger('click')
|
||||
wrapper.find('button.confirm').trigger('click')
|
||||
})
|
||||
|
||||
it('calls report mutation', async () => {
|
||||
it('calls report mutation', () => {
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('gets disabled', async () => {
|
||||
expect(wrapper.vm.disabled).toBe(true)
|
||||
})
|
||||
|
||||
it('sets success', async () => {
|
||||
it('sets success', () => {
|
||||
expect(wrapper.vm.success).toBe(true)
|
||||
})
|
||||
|
||||
it('displays a success message', async () => {
|
||||
it('displays a success message', () => {
|
||||
const calls = mocks.$t.mock.calls
|
||||
const expected = [['report.success']]
|
||||
expect(calls).toEqual(expect.arrayContaining(expected))
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
class="confirm"
|
||||
icon="exclamation-circle"
|
||||
:loading="loading"
|
||||
:disabled="disabled || loading"
|
||||
@click="confirm"
|
||||
>
|
||||
{{ $t('report.submit') }}
|
||||
@ -66,8 +65,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
success: false,
|
||||
loading: false,
|
||||
disabled: !this.isOpen
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -82,7 +80,6 @@ export default {
|
||||
methods: {
|
||||
async confirm() {
|
||||
this.loading = true
|
||||
this.disabled = true
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: gql`
|
||||
@ -101,7 +98,6 @@ export default {
|
||||
}, 1500)
|
||||
} catch (err) {
|
||||
this.$toast.error(err.message)
|
||||
this.disabled = false
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user