-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] assert that classNameBinding
items are strings
#15924
[BUGFIX beta] assert that classNameBinding
items are strings
#15924
Conversation
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.
Minor stylistic nit-picks, but overall looks good to me.
@@ -412,6 +412,18 @@ export function validatePositionalParameters(named: NamedArguments, positional: | |||
} | |||
|
|||
export function processComponentInitializationAssertions(component: Component, props: any) { | |||
assert(`classNameBindings must be strings: ${component.toString()}`, (() => { |
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.
Seems fine, but I would have assumed that the explicit .toString()
shouldn't have been needed inside template strings. Mind confirming?
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.
Yep, that's the case. I've updated the other similar tests to remove toString
and use template strings too
for (let i = 0; i < classNameBindings.length; i++) { | ||
let binding = classNameBindings[i]; | ||
|
||
if (typeof(binding) !== 'string') { |
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 think we generally prefer typeof binding !== 'string'
@rwjblue thanks for the feedback, the PR has been updated and is ready for review again |
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 rock, thank you!!
fixes #15851
(this was part of an Ember open source workshop in Intercom)