Skip to content

Commit

Permalink
[theme] convertLength does not work for fromUnit !== 'px' (#22739)
Browse files Browse the repository at this point in the history
  • Loading branch information
brorlarsnicklas authored Sep 25, 2020
1 parent b5d7f6d commit 2587f77
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion packages/material-ui/src/styles/cssUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function convertLength(baseFontSize) {
pxLength = toUnitless(length) * toUnitless(baseFontSize);
} else if (fromUnit === 'rem') {
pxLength = toUnitless(length) * toUnitless(baseFontSize);
return length;
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/src/styles/cssUtils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('cssUtils', () => {
it('should work as expected', () => {
const convert = convertLength('16px');
expect(convert('32px', 'rem')).to.equal('2rem');
expect(convert('2rem', 'px')).to.equal('32px');
});
});

Expand Down

0 comments on commit 2587f77

Please sign in to comment.