File tree Expand file tree Collapse file tree 3 files changed +32
-36
lines changed
packages/material-ui/src/styles Expand file tree Collapse file tree 3 files changed +32
-36
lines changed Original file line number Diff line number Diff line change 11export default function createMixins ( breakpoints , spacing , mixins ) {
22 return {
33 gutters : ( styles = { } ) => {
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- // );
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+ ) ;
2018
2119 return {
2220 paddingLeft : spacing ( 2 ) ,
Original file line number Diff line number Diff line change 11import { expect } from 'chai' ;
2+ import { consoleWarnMock } from 'test/utils/consoleErrorMock' ;
23import createMixins from './createMixins' ;
34import createMuiTheme from './createMuiTheme' ;
45
56describe ( 'createMixins' , ( ) => {
67 it ( 'should be able to override the breakpoint' , ( ) => {
78 const theme = createMuiTheme ( ) ;
8- const mixins = createMixins ( theme . breakpoints , theme . spacing , { } ) ;
9+ const mixins = createMixins ( theme . breakpoints , theme . spacing , { test : { display : 'block' } } ) ;
910
10- const mixin = mixins . gutters ( {
11- display : 'flex' ,
12- [ theme . breakpoints . up ( 'sm' ) ] : {
13- paddingLeft : 1 ,
14- } ,
11+ expect ( mixins . test ) . to . deep . equal ( { display : 'block' } ) ;
12+ } ) ;
13+
14+ describe ( 'v5 deprecations' , ( ) => {
15+ beforeEach ( ( ) => {
16+ consoleWarnMock . spy ( ) ;
1517 } ) ;
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 ,
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.' ) ;
2428 } ) ;
2529 } ) ;
2630} ) ;
Original file line number Diff line number Diff line change @@ -23,12 +23,6 @@ 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-
3226 describe ( 'shadows' , ( ) => {
3327 it ( 'should provide the default array' , ( ) => {
3428 const muiTheme = createMuiTheme ( ) ;
You can’t perform that action at this time.
0 commit comments