mirror of
https://github.com/lana-k/sqliteviz.git
synced 2026-03-24 15:06:17 +08:00
change repo structure
This commit is contained in:
27
tests/components/Common/Pager.spec.js
Normal file
27
tests/components/Common/Pager.spec.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { expect } from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Pager from '@/components/Common/Pager'
|
||||
|
||||
describe('Pager.vue', () => {
|
||||
afterEach(() => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
it('emits update:modelValue event with a page', async () => {
|
||||
const wrapper = mount(Pager, {
|
||||
props: {
|
||||
pageCount: 5,
|
||||
'onUpdate:modelValue': e => wrapper.setProps({ modelValue: e })
|
||||
}
|
||||
})
|
||||
|
||||
// click on 'next page' link
|
||||
await wrapper.find('.paginator-next').trigger('click')
|
||||
expect(wrapper.props('modelValue')).to.eql(2)
|
||||
|
||||
// click on the link to page 3 (it has index 2)
|
||||
await wrapper.findAll('.paginator-page-link')[2].trigger('click')
|
||||
expect(wrapper.props('modelValue')).to.eql(3)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user