mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
add masonry grid item tests
This commit is contained in:
parent
5abf6003cc
commit
0bb746804b
27
webapp/components/MasonryGrid/MasonryGridItem.spec.js
Normal file
27
webapp/components/MasonryGrid/MasonryGridItem.spec.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import MasonryGridItem from './MasonryGridItem'
|
||||
|
||||
describe('MasonryGridItem', () => {
|
||||
let wrapper
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(MasonryGridItem)
|
||||
wrapper.vm.$parent.$emit = jest.fn()
|
||||
})
|
||||
|
||||
it('emits "calculating-item-height" when starting calculation', async () => {
|
||||
wrapper.vm.calculateItemHeight()
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const firstCallArgument = wrapper.vm.$parent.$emit.mock.calls[0][0]
|
||||
expect(firstCallArgument).toBe('calculating-item-height')
|
||||
})
|
||||
|
||||
it('emits "finished-calculating-item-height" after the calculation', async () => {
|
||||
wrapper.vm.calculateItemHeight()
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const secondCallArgument = wrapper.vm.$parent.$emit.mock.calls[1][0]
|
||||
expect(secondCallArgument).toBe('finished-calculating-item-height')
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user