Skip to content

Commit

Permalink
fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Nov 11, 2024
1 parent ad6be40 commit 130cea6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/mui-material/src/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function generateRowGap({ theme, ownerState }) {

if (themeSpacing !== '0px') {
return {
marginTop: theme.spacing(-propValue),
marginTop: `-${themeSpacing}`,
[`& > .${gridClasses.item}`]: {
paddingTop: themeSpacing,
},
Expand Down Expand Up @@ -214,7 +214,7 @@ export function generateColumnGap({ theme, ownerState }) {
styles = handleBreakpoints({ theme }, columnSpacingValues, (propValue, breakpoint) => {
const themeSpacing = theme.spacing(propValue);
if (themeSpacing !== '0px') {
const negativeValue = theme.spacing(-propValue);
const negativeValue = `-${themeSpacing}`;
return {
width: `calc(100% + ${themeSpacing})`,
marginLeft: negativeValue,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Grid/Grid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ describe('Material UI <Grid />', () => {
generateRowGap({
ownerState: {
container: true,
rowSpacing: { xs: 1, sm: 2 },
rowSpacing: { xs: 1, sm: '16px' },
},
theme,
}),
Expand All @@ -769,7 +769,7 @@ describe('Material UI <Grid />', () => {
generateColumnGap({
ownerState: {
container: true,
columnSpacing: { xs: 1, sm: 2 },
columnSpacing: { xs: 1, sm: '16px' },
},
theme,
}),
Expand Down
6 changes: 6 additions & 0 deletions packages/mui-system/src/createTheme/createSpacing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ describe('createSpacing', () => {
expect(spacing(1, 'auto', 2, 3)).to.equal('0.25rem auto 0.5rem 0.75rem');
});

it('should support valid CSS unit', () => {
const spacing = createSpacing();
expect(spacing('16px')).to.equal('16px');
expect(spacing('1rem')).to.equal('1rem');
});

describe('warnings', () => {
it('should warn for wrong input', () => {
expect(() => {
Expand Down

0 comments on commit 130cea6

Please sign in to comment.