mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
improve test
This commit is contained in:
parent
65e7eb10db
commit
317067ab96
@ -154,43 +154,16 @@ describe('Creation', () => {
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('remove item', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper
|
||||
.findAll('table')
|
||||
.at(0)
|
||||
.findAll('tbody > tr')
|
||||
.at(1)
|
||||
.find('button')
|
||||
.trigger('click')
|
||||
await wrapper
|
||||
.findAll('table')
|
||||
.at(1)
|
||||
.findAll('tbody > tr')
|
||||
.at(0)
|
||||
.find('button')
|
||||
.trigger('click')
|
||||
})
|
||||
|
||||
describe('cancel remove item', () => {
|
||||
it('has one item in left table', () => {
|
||||
expect(wrapper.findAll('table').at(0).findAll('tbody > tr')).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('has one item in right table', () => {
|
||||
expect(wrapper.findAll('table').at(1).findAll('tbody > tr')).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('confirm remove item', () => {
|
||||
describe('remove item', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.findAll('#overlay').at(1).findAll('button').at(1).trigger('click')
|
||||
})
|
||||
|
||||
it('closes the dialog', () => {
|
||||
expect(wrapper.findAll('#overlay').at(1).isVisible()).toBeFalsy()
|
||||
await wrapper
|
||||
.findAll('table')
|
||||
.at(1)
|
||||
.findAll('tbody > tr')
|
||||
.at(0)
|
||||
.find('button')
|
||||
.trigger('click')
|
||||
})
|
||||
|
||||
it('has two items in left table', () => {
|
||||
@ -211,32 +184,24 @@ describe('Creation', () => {
|
||||
expect(storeCommitMock).toBeCalledWith('setUserSelectedInMassCreation', [])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// this can only happen after API call in CreationForm
|
||||
describe('remove all bookmarks', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper
|
||||
.findAll('table')
|
||||
.at(0)
|
||||
.findAll('tbody > tr')
|
||||
.at(1)
|
||||
.find('button')
|
||||
.trigger('click')
|
||||
jest.clearAllMocks()
|
||||
wrapper.findComponent({ name: 'CreationFormular' }).vm.$emit('remove-all-bookmark')
|
||||
})
|
||||
describe('remove all bookmarks', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.find('button.btn-light').trigger('click')
|
||||
})
|
||||
|
||||
it('has no items in right table', () => {
|
||||
expect(wrapper.findAll('table').at(1).findAll('tbody > tr')).toHaveLength(0)
|
||||
})
|
||||
it('has no items in right table', () => {
|
||||
expect(wrapper.findAll('table').at(1).findAll('tbody > tr')).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('commits empty array to userSelectedInMassCreation', () => {
|
||||
expect(storeCommitMock).toBeCalledWith('setUserSelectedInMassCreation', [])
|
||||
})
|
||||
it('commits empty array to userSelectedInMassCreation', () => {
|
||||
expect(storeCommitMock).toBeCalledWith('setUserSelectedInMassCreation', [])
|
||||
})
|
||||
|
||||
it('calls searchUsers', () => {
|
||||
expect(apolloQueryMock).toBeCalled()
|
||||
it('calls searchUsers', () => {
|
||||
expect(apolloQueryMock).toBeCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<b-col cols="12" lg="6" class="shadow p-3 mb-5 rounded bg-info">
|
||||
<div v-show="itemsMassCreation.length > 0">
|
||||
<div class="text-right pr-4 mb-1">
|
||||
<b-button @click="removeAllBookmark()" variant="light">
|
||||
<b-button @click="removeAllBookmarks()" variant="light">
|
||||
<b-icon icon="x" scale="2" variant="danger"></b-icon>
|
||||
|
||||
{{ $t('remove_all') }}
|
||||
@ -49,7 +49,7 @@
|
||||
type="massCreation"
|
||||
:creation="creation"
|
||||
:items="itemsMassCreation"
|
||||
@remove-all-bookmark="removeAllBookmark"
|
||||
@remove-all-bookmark="removeAllBookmarks"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -131,7 +131,7 @@ export default {
|
||||
)
|
||||
this.$store.commit('setUserSelectedInMassCreation', this.itemsMassCreation)
|
||||
},
|
||||
removeAllBookmark() {
|
||||
removeAllBookmarks() {
|
||||
this.itemsMassCreation = []
|
||||
this.$store.commit('setUserSelectedInMassCreation', [])
|
||||
this.getUsers()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user