-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[material-ui][Typography] Color prop check for primitive type #39071
Changes from 5 commits
12f5d96
0e1ea8e
04e6b61
71a5746
de19349
3fb84bb
c142b79
088a77d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,14 @@ export function getStyleValue(themeMapping, transform, propValueFinal, userValue | |
value = getPath(themeMapping, propValueFinal) || userValue; | ||
} | ||
|
||
if (typeof value === 'object') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
console.warn( | ||
`MUI: The value found in theme for prop: "${propValueFinal}" is an [Object] instead of string or number. Check if you forgot to add the correct dotted notation, eg, "background.paper" instead of "background".`, | ||
); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also set the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, it was removed on purpose because there are cases when |
||
} | ||
|
||
if (transform) { | ||
value = transform(value, userValue, themeMapping); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use sinon. Same change in other place as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unable to pass any of the warn tests this way, I get similar errors for each one of them:
I am unable to debug this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here'e the changes I did - https://github.com/mui/material-ui/compare/master...brijeshb42:material-ui:issue-38478?expand=1
Basically, you add to call
toWarnDev([msg, msg])
expecting the warn to be called twice. That's why it was failing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can I merge these changes? kindly tell if anything else remaining to work on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just copy-paste the
toWarnDev
related changes to your branch. Nothing else after that.