Skip to content

Commit f9ff3f5

Browse files
author
kaptron
committed
fix foamcoreGrid unit test
1 parent f70c501 commit f9ff3f5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

__tests__/ui/grid/FoamcoreGrid.unit.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,10 @@ describe('FoamcoreGrid', () => {
541541
describe('totalGridSize', () => {
542542
beforeEach(() => {
543543
props.collection.isSplitLevel = false
544+
props.collection.isSplitLevelBottom = false
544545
props.collection.max_row_index = 0
546+
props.collection.lastInsertedRow = 0
547+
props.collection.collection_cards = [{ id: '1', maxRow: 1 }]
545548
props.uiStore.visibleRows = { min: 0, max: 5, num: 5 }
546549
rerender()
547550
})
@@ -556,18 +559,19 @@ describe('FoamcoreGrid', () => {
556559
expect(height).toEqual(calculatedHeight)
557560
})
558561

559-
describe('for split-level collections', () => {
562+
describe('for split-level collections, with canEdit true', () => {
560563
beforeEach(() => {
564+
props.collection.canEdit = true
561565
props.collection.isSplitLevel = true
562566
rerender()
563567
})
564568

565-
it('should calculate the right height for non-split level collections', () => {
569+
it('should calculate the right height', () => {
566570
const { height } = component.totalGridSize
567571
const { relativeZoomLevel } = component
568572
const { gridSettings } = component
569573
const { gridH, gutter } = gridSettings
570-
const maxRows = props.collection.max_row_index + 1
574+
const maxRows = props.collection.max_row_index + 2
571575
const calculatedHeight =
572576
((gridH + gutter) * maxRows) / relativeZoomLevel
573577
expect(height).toEqual(calculatedHeight)
@@ -581,7 +585,7 @@ describe('FoamcoreGrid', () => {
581585
rerender()
582586
})
583587

584-
it('should calculate the right height for non-split level collections', () => {
588+
it('should calculate the right height', () => {
585589
const { height } = component.totalGridSize
586590
const { relativeZoomLevel } = component
587591
const { gridSettings } = component

0 commit comments

Comments
 (0)