Fix tests for pagination buttons

- Now the buttons are disabled instead of remove from the DOM.
This commit is contained in:
Wolfgang Huß 2020-09-25 13:31:35 +02:00
parent 965dc48dae
commit 7fd861caa0

View File

@ -46,18 +46,17 @@ describe('PaginationButtons.vue', () => {
})
})
describe('back button', () => {
describe('previous button', () => {
it('is disabled by default', () => {
const backButton = wrapper.find('[data-test="previous-button"]')
expect(backButton.attributes().disabled).toEqual('disabled')
const previousButton = wrapper.find('[data-test="previous-button"]')
expect(previousButton.attributes().disabled).toEqual('disabled')
})
it('is enabled if hasPrevious is true', async () => {
wrapper.setProps({ hasPrevious: true })
await wrapper.vm.$nextTick()
const backButton = wrapper.find('[data-test="previous-button"]')
// expect(wrapper.find('.previous-button').exists()).toEqual(true)
expect(backButton.attributes().disabled).toBeUndefined()
const previousButton = wrapper.find('[data-test="previous-button"]')
expect(previousButton.attributes().disabled).toBeUndefined()
})
it('emits back when clicked', async () => {
@ -79,7 +78,6 @@ describe('PaginationButtons.vue', () => {
wrapper.setProps({ showPageCounter: false })
await wrapper.vm.$nextTick()
const paginationPageCount = wrapper.find('[data-test="pagination-pageCount"]')
// expect(wrapper.find('.pagination-pageCount').exists()).toEqual(false)
expect(paginationPageCount.exists()).toEqual(false)
})
})