-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[theme] Deprecate theme.mixins.gutters (#22245)
- Loading branch information
1 parent
a4a6b3d
commit a3df136
Showing
3 changed files
with
32 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import { expect } from 'chai'; | ||
import { consoleWarnMock } from 'test/utils/consoleErrorMock'; | ||
import createMixins from './createMixins'; | ||
import createMuiTheme from './createMuiTheme'; | ||
|
||
describe('createMixins', () => { | ||
it('should be able to override the breakpoint', () => { | ||
const theme = createMuiTheme(); | ||
const mixins = createMixins(theme.breakpoints, theme.spacing, {}); | ||
const mixins = createMixins(theme.breakpoints, theme.spacing, { test: { display: 'block' } }); | ||
|
||
const mixin = mixins.gutters({ | ||
display: 'flex', | ||
[theme.breakpoints.up('sm')]: { | ||
paddingLeft: 1, | ||
}, | ||
expect(mixins.test).to.deep.equal({ display: 'block' }); | ||
}); | ||
|
||
describe('v5 deprecations', () => { | ||
beforeEach(() => { | ||
consoleWarnMock.spy(); | ||
}); | ||
expect(mixin).to.deep.equal({ | ||
'@media (min-width:600px)': { | ||
paddingLeft: 1, | ||
paddingRight: 24, | ||
}, | ||
display: 'flex', | ||
paddingLeft: 16, | ||
paddingRight: 16, | ||
|
||
afterEach(() => { | ||
consoleWarnMock.reset(); | ||
}); | ||
|
||
it('issues a warning for theme.mixins.gutters', () => { | ||
const theme = createMuiTheme(); | ||
theme.mixins.gutters(); | ||
expect(consoleWarnMock.callCount()).to.equal(1); | ||
expect(consoleWarnMock.messages()[0]).to.include('theme.mixins.gutters() is deprecated.'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters