Skip to content

Commit fb1679c

Browse files
Revert "[theme] Deprecate theme.mixins.gutters (mui#22245)"
This reverts commit c5c6f5d.
1 parent 80fc767 commit fb1679c

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

packages/material-ui/src/styles/createMixins.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
export default function createMixins(breakpoints, spacing, mixins) {
22
return {
33
gutters: (styles = {}) => {
4-
console.warn(
5-
[
6-
'Material-UI: theme.mixins.gutters() is deprecated.',
7-
'You can use the source of the mixin directly:',
8-
`
9-
paddingLeft: theme.spacing(2),
10-
paddingRight: theme.spacing(2),
11-
[theme.breakpoints.up('sm')]: {
12-
paddingLeft: theme.spacing(3),
13-
paddingRight: theme.spacing(3),
14-
},
15-
`,
16-
].join('\n'),
17-
);
4+
// To deprecate in v4.1
5+
// warning(
6+
// false,
7+
// [
8+
// 'Material-UI: Theme.mixins.gutters() is deprecated.',
9+
// 'You can use the source of the mixin directly:',
10+
// `
11+
// paddingLeft: theme.spacing(2),
12+
// paddingRight: theme.spacing(2),
13+
// [theme.breakpoints.up('sm')]: {
14+
// paddingLeft: theme.spacing(3),
15+
// paddingRight: theme.spacing(3),
16+
// },
17+
// `,
18+
// ].join('\n'),
19+
// );
1820

1921
return {
2022
paddingLeft: spacing(2),
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
import { expect } from 'chai';
2-
import { consoleWarnMock } from 'test/utils/consoleErrorMock';
32
import createMixins from './createMixins';
43
import createMuiTheme from './createMuiTheme';
54

65
describe('createMixins', () => {
76
it('should be able to override the breakpoint', () => {
87
const theme = createMuiTheme();
9-
const mixins = createMixins(theme.breakpoints, theme.spacing, { test: { display: 'block' } });
8+
const mixins = createMixins(theme.breakpoints, theme.spacing, {});
109

11-
expect(mixins.test).to.deep.equal({ display: 'block' });
12-
});
13-
14-
describe('v5 deprecations', () => {
15-
beforeEach(() => {
16-
consoleWarnMock.spy();
10+
const mixin = mixins.gutters({
11+
display: 'flex',
12+
[theme.breakpoints.up('sm')]: {
13+
paddingLeft: 1,
14+
},
1715
});
18-
19-
afterEach(() => {
20-
consoleWarnMock.reset();
21-
});
22-
23-
it('issues a warning for theme.mixins.gutters', () => {
24-
const theme = createMuiTheme();
25-
theme.mixins.gutters();
26-
expect(consoleWarnMock.callCount()).to.equal(1);
27-
expect(consoleWarnMock.messages()[0]).to.include('theme.mixins.gutters() is deprecated.');
16+
expect(mixin).to.deep.equal({
17+
'@media (min-width:600px)': {
18+
paddingLeft: 1,
19+
paddingRight: 24,
20+
},
21+
display: 'flex',
22+
paddingLeft: 16,
23+
paddingRight: 16,
2824
});
2925
});
3026
});

packages/material-ui/src/styles/createMuiTheme.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ describe('createMuiTheme', () => {
2323
expect(muiTheme.transitions.duration.shorter).to.not.equal(undefined);
2424
});
2525

26+
it('should use the defined spacing for the gutters mixin', () => {
27+
const spacing = 100;
28+
const muiTheme = createMuiTheme({ spacing });
29+
expect(muiTheme.mixins.gutters().paddingLeft).to.equal(spacing * 2);
30+
});
31+
2632
describe('shadows', () => {
2733
it('should provide the default array', () => {
2834
const muiTheme = createMuiTheme();

0 commit comments

Comments
 (0)