Merge pull request #1336 from Human-Connection/fix-vue-warnings-masonry-grid

Fix vue warnings for MasonryGrid/MasonGridItem
This commit is contained in:
Robert Schäfer 2019-08-21 15:49:21 +02:00 committed by GitHub
commit ce4f3bdff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -1,22 +1,28 @@
import { shallowMount } from '@vue/test-utils'
import { mount, createLocalVue } from '@vue/test-utils'
import Styleguide from '@human-connection/styleguide'
import MasonryGrid from './MasonryGrid'
const localVue = createLocalVue()
localVue.use(Styleguide)
describe('MasonryGrid', () => {
let wrapper
let masonryGrid
beforeEach(() => {
wrapper = shallowMount(MasonryGrid)
wrapper = mount(MasonryGrid, { localVue })
masonryGrid = wrapper.vm.$children[0]
})
it('adds the "reset-grid-height" class when one or more children are updating', () => {
wrapper.trigger('calculating-item-height')
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 })
wrapper.trigger('finished-calculating-item-height')
masonryGrid.$emit('finished-calculating-item-height')
expect(wrapper.classes()).not.toContain('reset-grid-height')
})

View File

@ -1,11 +1,17 @@
import { shallowMount } from '@vue/test-utils'
import { config, shallowMount, createLocalVue } from '@vue/test-utils'
import Styleguide from '@human-connection/styleguide'
import MasonryGridItem from './MasonryGridItem'
const localVue = createLocalVue()
localVue.use(Styleguide)
config.stubs['ds-grid-item'] = '<span><slot /></span>'
describe('MasonryGridItem', () => {
let wrapper
beforeEach(() => {
wrapper = shallowMount(MasonryGridItem)
wrapper = shallowMount(MasonryGridItem, { localVue })
wrapper.vm.$parent.$emit = jest.fn()
})