diff --git a/src/Ratio.tsx b/src/Ratio.tsx index 7ae03134e5..7aad47dd53 100644 --- a/src/Ratio.tsx +++ b/src/Ratio.tsx @@ -37,7 +37,7 @@ const defaultProps = { }; function toPercent(num: number): string { - if (num <= 0 || num > 100) return '100%'; + if (num <= 0) return '100%'; if (num < 1) return `${num * 100}%`; return `${num}%`; } diff --git a/test/RatioSpec.tsx b/test/RatioSpec.tsx index 6a364aacf4..b9ea21643c 100644 --- a/test/RatioSpec.tsx +++ b/test/RatioSpec.tsx @@ -49,7 +49,7 @@ describe('Ratio', () => { styleAttr.should.match(/--bs-aspect-ratio:[ ]*100%;/); }); - it('should support use 100% as custom ratio if aspectRatio is greater than 100', () => { + it('should support aspectRatio greater than 100', () => { const { getByTestId } = render(
@@ -57,6 +57,6 @@ describe('Ratio', () => { ); const ratioElem = getByTestId('test'); const styleAttr = ratioElem.getAttribute('style')!; - styleAttr.should.match(/--bs-aspect-ratio:[ ]*100%;/); + styleAttr.should.match(/--bs-aspect-ratio:[ ]*200%;/); }); });