Alina Beck 77f4810ddc set up global localVue
by setting up localVue with all required plugins (such as styleguide and vuex)
in a separate testSetup file we can avoid doing this individually in all component tests
the testSetup is executed before each test suite, so each test file gets a fresh
instance of localVue
2019-11-20 12:31:40 +03:00

29 lines
777 B
JavaScript

import { mount } from '@vue/test-utils'
import MasonryGrid from './MasonryGrid'
const localVue = global.localVue
describe('MasonryGrid', () => {
let wrapper
let masonryGrid
beforeEach(() => {
wrapper = mount(MasonryGrid, { localVue })
masonryGrid = wrapper.vm.$children[0]
})
it('adds the "reset-grid-height" class when one or more children are updating', () => {
masonryGrid.$emit('calculating-item-height')
expect(wrapper.classes()).toContain('reset-grid-height')
})
it('removes the "reset-grid-height" class when all children have completed updating', () => {
wrapper.setData({ itemsCalculating: 1 })
masonryGrid.$emit('finished-calculating-item-height')
expect(wrapper.classes()).not.toContain('reset-grid-height')
})
})