File tree Expand file tree Collapse file tree 2 files changed +32
-30
lines changed
packages/material-ui/src/styles Expand file tree Collapse file tree 2 files changed +32
-30
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} ) ;
You can’t perform that action at this time.
0 commit comments