Skip to content

Commit

Permalink
[core] Remove references to other objects from created theme (mui#22523)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Sep 9, 2020
1 parent cb08462 commit 27fe6a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions packages/material-ui/src/Paper/Paper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ describe('<Paper />', () => {

it('allows custom elevations via theme.shadows', () => {
const theme = createMuiTheme();
// Theme.shadows holds a reference to `@material-ui/core/styles#shadows`
// Mutating it causes side effects in other tests
theme.shadows = theme.shadows.slice();
theme.shadows.push('20px 20px');
const { getByTestId } = render(
<ThemeProvider theme={theme}>
Expand Down
7 changes: 4 additions & 3 deletions packages/material-ui/src/styles/createMuiTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ function createMuiTheme(options = {}, ...args) {
mixins: createMixins(breakpoints, spacing, mixinsInput),
components: {}, // Inject component definitions
palette,
shadows,
// Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
shadows: shadows.slice(),
typography: createTypography(palette, typographyInput),
spacing,
shape,
shape: { ...shape },
transitions: { duration, easing, create, getAutoHeightDuration },
zIndex,
zIndex: { ...zIndex },
},
other,
);
Expand Down

0 comments on commit 27fe6a3

Please sign in to comment.