diff --git a/__tests__/utils/calendar/__snapshots__/get-ordered-groups-with-items.js.snap b/__tests__/utils/calendar/__snapshots__/get-ordered-groups-with-items.js.snap index f8728a9c0..865db637f 100644 --- a/__tests__/utils/calendar/__snapshots__/get-ordered-groups-with-items.js.snap +++ b/__tests__/utils/calendar/__snapshots__/get-ordered-groups-with-items.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`getGroupWithItemDimensions should work as expected 1`] = ` +exports[`getOrderedGroupsWithItems should work as expected 1`] = ` Object { "1": Object { "group": Object { diff --git a/__tests__/utils/calendar/get-group-with-item-dimensions.js b/__tests__/utils/calendar/get-group-with-item-dimensions.js index de699197b..7b191ee0f 100644 --- a/__tests__/utils/calendar/get-group-with-item-dimensions.js +++ b/__tests__/utils/calendar/get-group-with-item-dimensions.js @@ -52,5 +52,23 @@ describe('getGroupWithItemDimensions', ()=>{ props.stackItems )).not.toBe(groupWithItems) }) + it('should allow for the group.height property to override the manual calculation', () => { + const testHeight = 567.6 + const groupWithItemsAndSetHeight ={ + group: {id: '1', height: testHeight}, + items + } + const result = getGroupWithItemDimensions( + groupWithItemsAndSetHeight, + props.keys, + state.canvasTimeStart, + state.canvasTimeEnd, + state.width*3, + props.lineHeight, + props.itemHeightRatio, + props.stackItems + ) + expect(result.height).toEqual(testHeight) + }) }) diff --git a/__tests__/utils/calendar/get-ordered-groups-with-items.js b/__tests__/utils/calendar/get-ordered-groups-with-items.js index 5e1d6afa5..00b7be4ad 100644 --- a/__tests__/utils/calendar/get-ordered-groups-with-items.js +++ b/__tests__/utils/calendar/get-ordered-groups-with-items.js @@ -3,7 +3,7 @@ import {items, groups} from '../../../__fixtures__/itemsAndGroups' import {props} from '../../../__fixtures__/stateAndProps' -describe('getGroupWithItemDimensions', ()=>{ +describe('getOrderedGroupsWithItems', ()=>{ it('should work as expected', ()=>{ expect(getOrderedGroupsWithItems(groups, items, props.keys)).toMatchSnapshot() }) diff --git a/src/lib/utility/calendar.js b/src/lib/utility/calendar.js index 6daaa0407..0383fe7bb 100644 --- a/src/lib/utility/calendar.js +++ b/src/lib/utility/calendar.js @@ -689,7 +689,13 @@ export function getGroupWithItemDimensions( itemHeightRatio }) }) - const { groupHeight } = stackGroup(itemDimensions, stackItems, lineHeight) + //If group height property is specified, use that instead of manual calculation + let groupHeightProp = null; + if (groupWithItems && groupWithItems.group) groupHeightProp = groupWithItems.group.height + const { groupHeight } = groupHeightProp ? + { groupHeight: groupHeightProp } : + stackGroup(itemDimensions, stackItems, lineHeight) + return { ...groupWithItems, itemDimensions: itemDimensions,