Skip to content

Commit d23c82a

Browse files
handle the second review
1 parent d4b065f commit d23c82a

File tree

13 files changed

+35
-18
lines changed

13 files changed

+35
-18
lines changed

docs/src/pages/style/typography/typography.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,5 @@ Deprecation warnings are logged when:
103103
- They will be restyled and `useNextVariants` is falsy. This includes: body2, body1, caption, button
104104

105105
In some cases the deprecation warnings can break your test suite which might be inconvenient.
106-
In those cases you can set the environment variable `MUI_SUPPRESS_DEPRECATION_WARNINGS` to
107-
a truthy value. Passing `suppressDeprecationWarnings: true` to the typography options in
108-
`createMuiTheme` is equivalent.
106+
In those cases you can set the environment variable `MUI_SUPPRESS_DEPRECATION_WARNINGS` to a truthy value.
107+
Passing `suppressDeprecationWarnings: true` to the typography options in `createMuiTheme` is equivalent.

packages/material-ui/src/CardHeader/CardHeader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ function CardHeader(props) {
5656
if (title != null && title.type !== Typography && !disableTypography) {
5757
title = (
5858
<Typography
59-
variant={avatar ? 'body2' : 'h5'}
59+
variant={avatar ? 'body2' : 'headline'}
60+
suppressDeprecationWarnings
6061
className={classes.title}
6162
component="span"
6263
{...titleTypographyProps}

packages/material-ui/src/CardHeader/CardHeader.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('<CardHeader />', () => {
5959
it('should render the title as headline text', () => {
6060
const title = wrapper.childAt(0);
6161
assert.strictEqual(title.type(), Typography);
62-
assert.strictEqual(title.props().variant, 'h5');
62+
assert.strictEqual(title.props().variant, 'headline');
6363
});
6464

6565
it('should render the subheader as body1 secondary text', () => {

packages/material-ui/src/DialogContentText/DialogContentText.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const styles = {
1111
};
1212

1313
function DialogContentText(props) {
14-
return <Typography component="p" variant="subtitle1" color="textSecondary" {...props} />;
14+
return <Typography component="p" variant="subheading" color="textSecondary" {...props} />;
1515
}
1616

1717
DialogContentText.propTypes = {

packages/material-ui/src/DialogTitle/DialogTitle.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ function DialogTitle(props) {
1818

1919
return (
2020
<div className={classNames(classes.root, className)} {...other}>
21-
{disableTypography ? children : <Typography variant="h6">{children}</Typography>}
21+
{disableTypography ? (
22+
children
23+
) : (
24+
<Typography variant="title" suppressDeprecationWarnings>
25+
{children}
26+
</Typography>
27+
)}
2228
</div>
2329
);
2430
}

packages/material-ui/src/ListItemText/ListItemText.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ function ListItemText(props, context) {
5959
if (primary != null && primary.type !== Typography && !disableTypography) {
6060
primary = (
6161
<Typography
62-
variant="subtitle1"
62+
variant="subheading"
63+
suppressDeprecationWarnings
6364
className={classNames(classes.primary, { [classes.textDense]: dense })}
6465
component="span"
6566
{...primaryTypographyProps}

packages/material-ui/src/ListItemText/ListItemText.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('<ListItemText />', () => {
4141
const wrapper = shallow(<ListItemText primary="This is the primary text" />);
4242
assert.strictEqual(wrapper.children().length, 1, 'should have 1 child');
4343
assert.strictEqual(wrapper.childAt(0).type(), Typography);
44-
assert.strictEqual(wrapper.childAt(0).props().variant, 'subtitle1');
44+
assert.strictEqual(wrapper.childAt(0).props().variant, 'subheading');
4545
assert.strictEqual(
4646
wrapper
4747
.childAt(0)
@@ -111,7 +111,7 @@ describe('<ListItemText />', () => {
111111

112112
assert.strictEqual(wrapper.children().length, 2, 'should have 2 children');
113113
assert.strictEqual(wrapper.childAt(0).type(), Typography);
114-
assert.strictEqual(wrapper.childAt(0).props().variant, 'subtitle1');
114+
assert.strictEqual(wrapper.childAt(0).props().variant, 'subheading');
115115
assert.strictEqual(
116116
wrapper
117117
.childAt(0)
@@ -152,7 +152,7 @@ describe('<ListItemText />', () => {
152152

153153
assert.strictEqual(wrapper.children().length, 2, 'should have 2 children');
154154
assert.strictEqual(wrapper.childAt(0).type(), Typography);
155-
assert.strictEqual(wrapper.childAt(0).props().variant, 'subtitle1');
155+
assert.strictEqual(wrapper.childAt(0).props().variant, 'subheading');
156156
assert.strictEqual(
157157
wrapper
158158
.childAt(0)

packages/material-ui/src/MenuItem/MenuItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ListItem from '../ListItem';
99
export const styles = theme => ({
1010
/* Styles applied to the root element. */
1111
root: {
12-
...theme.typography.subtitle1,
12+
...theme.typography.subheading,
1313
height: 24,
1414
boxSizing: 'content-box',
1515
width: 'auto',

packages/material-ui/src/Modal/Modal.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ describe('<Modal />', () => {
219219
2,
220220
'should have 2 children, the backdrop and the test container',
221221
);
222-
assert.strictEqual(typeof modal.children[0], 'object');
223-
assert.strictEqual(modal.children[1], container, 'should be the container');
222+
assert.strictEqual(modal.children[0] != null, true);
223+
assert.strictEqual(modal.children[1], container);
224224
});
225225
});
226226

packages/material-ui/src/Typography/Typography.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface TypographyProps
1212
gutterBottom?: boolean;
1313
headlineMapping?: { [type in Style]: string };
1414
noWrap?: boolean;
15+
suppressDeprecationWarnings?: boolean;
1516
paragraph?: boolean;
1617
variant?: Style | 'inherit';
1718
}

0 commit comments

Comments
 (0)