File tree Expand file tree Collapse file tree 3 files changed +36
-32
lines changed
packages/material-ui/src/styles Expand file tree Collapse file tree 3 files changed +36
-32
lines changed Original file line number Diff line number Diff line change 1
1
export default function createMixins ( breakpoints , spacing , mixins ) {
2
2
return {
3
3
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
+ // );
18
20
19
21
return {
20
22
paddingLeft : spacing ( 2 ) ,
Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
- import { consoleWarnMock } from 'test/utils/consoleErrorMock' ;
3
2
import createMixins from './createMixins' ;
4
3
import createMuiTheme from './createMuiTheme' ;
5
4
6
5
describe ( 'createMixins' , ( ) => {
7
6
it ( 'should be able to override the breakpoint' , ( ) => {
8
7
const theme = createMuiTheme ( ) ;
9
- const mixins = createMixins ( theme . breakpoints , theme . spacing , { test : { display : 'block' } } ) ;
8
+ const mixins = createMixins ( theme . breakpoints , theme . spacing , { } ) ;
10
9
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
+ } ,
17
15
} ) ;
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 ,
28
24
} ) ;
29
25
} ) ;
30
26
} ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ describe('createMuiTheme', () => {
23
23
expect ( muiTheme . transitions . duration . shorter ) . to . not . equal ( undefined ) ;
24
24
} ) ;
25
25
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
+
26
32
describe ( 'shadows' , ( ) => {
27
33
it ( 'should provide the default array' , ( ) => {
28
34
const muiTheme = createMuiTheme ( ) ;
You can’t perform that action at this time.
0 commit comments