From 5abf6003cc40cb071e7258eb2b375121d07dda92 Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Mon, 19 Aug 2019 13:15:13 +0100 Subject: [PATCH] add tests for masonry grid --- .../MasonryGrid/MasonryGrid.spec.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 webapp/components/MasonryGrid/MasonryGrid.spec.js diff --git a/webapp/components/MasonryGrid/MasonryGrid.spec.js b/webapp/components/MasonryGrid/MasonryGrid.spec.js new file mode 100644 index 000000000..8cedac652 --- /dev/null +++ b/webapp/components/MasonryGrid/MasonryGrid.spec.js @@ -0,0 +1,23 @@ +import { shallowMount } from '@vue/test-utils' +import MasonryGrid from './MasonryGrid' + +describe('MasonryGrid', () => { + let wrapper + + beforeEach(() => { + wrapper = shallowMount(MasonryGrid) + }) + + it('adds the "reset-grid-height" class when one or more children are updating', () => { + wrapper.trigger('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') + + expect(wrapper.classes()).not.toContain('reset-grid-height') + }) +})