mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
- Emotions buttons were not displaying images correctly - Follow vue guidelines for multiword naming convention - Favor tokens over magic px numbers
67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
|
|
import Paginate from './Paginate'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('Paginate.vue', () => {
|
|
let propsData = {}
|
|
let wrapper
|
|
let nextButton
|
|
let backButton
|
|
|
|
const Wrapper = () => {
|
|
return mount(Paginate, { propsData, localVue })
|
|
}
|
|
|
|
describe('mount', () => {
|
|
describe('next button', () => {
|
|
beforeEach(() => {
|
|
propsData.hasNext = true
|
|
wrapper = Wrapper()
|
|
nextButton = wrapper.find('[data-test="next-button"]')
|
|
})
|
|
|
|
it('is disabled by default', () => {
|
|
propsData = {}
|
|
wrapper = Wrapper()
|
|
nextButton = wrapper.find('[data-test="next-button"]')
|
|
expect(nextButton.attributes().disabled).toEqual('disabled')
|
|
})
|
|
|
|
it('is enabled if hasNext is true', () => {
|
|
expect(nextButton.attributes().disabled).toBeUndefined()
|
|
})
|
|
|
|
it('emits next when clicked', async () => {
|
|
await nextButton.trigger('click')
|
|
expect(wrapper.emitted().next).toHaveLength(1)
|
|
})
|
|
})
|
|
|
|
describe('back button', () => {
|
|
beforeEach(() => {
|
|
propsData.hasPrevious = true
|
|
wrapper = Wrapper()
|
|
backButton = wrapper.find('[data-test="previous-button"]')
|
|
})
|
|
|
|
it('is disabled by default', () => {
|
|
propsData = {}
|
|
wrapper = Wrapper()
|
|
backButton = wrapper.find('[data-test="previous-button"]')
|
|
expect(backButton.attributes().disabled).toEqual('disabled')
|
|
})
|
|
|
|
it('is enabled if hasPrevious is true', () => {
|
|
expect(backButton.attributes().disabled).toBeUndefined()
|
|
})
|
|
|
|
it('emits back when clicked', async () => {
|
|
await backButton.trigger('click')
|
|
expect(wrapper.emitted().back).toHaveLength(1)
|
|
})
|
|
})
|
|
})
|
|
})
|