diff --git a/react/BottomSheet/helpers.js b/react/BottomSheet/helpers.js index 5ac14552a8..b26905c3c7 100644 --- a/react/BottomSheet/helpers.js +++ b/react/BottomSheet/helpers.js @@ -26,7 +26,6 @@ export const computeMediumHeight = ({ }) => { const mediumHeightOrWithRatio = mediumHeight || Math.round(maxHeight * mediumHeightRatio) - if (backdrop) { if (mediumHeightOrWithRatio < innerContentHeight) { return mediumHeightOrWithRatio < maxHeight @@ -35,7 +34,7 @@ export const computeMediumHeight = ({ } return innerContentHeight > maxHeight ? maxHeight : innerContentHeight } - + if (innerContentHeight < mediumHeightOrWithRatio) return innerContentHeight return mediumHeightOrWithRatio > maxHeight ? maxHeight : mediumHeightOrWithRatio diff --git a/react/BottomSheet/helpers.spec.js b/react/BottomSheet/helpers.spec.js index bc05cb341d..76fa4df2b2 100644 --- a/react/BottomSheet/helpers.spec.js +++ b/react/BottomSheet/helpers.spec.js @@ -57,6 +57,17 @@ describe('computeMediumHeight', () => { expect(res).toBe(800) }) + + it('should return the innerContentHeight if innerContentHeight < mediumHeight', () => { + const res = computeMediumHeight({ + backdrop: false, + maxHeight: 800, + mediumHeight: 400, + innerContentHeight: 200 + }) + + expect(res).toBe(200) + }) }) describe('with backdrop', () => {