-
Notifications
You must be signed in to change notification settings - Fork 27
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
Ember cli string helpers replacement #8320
Ember cli string helpers replacement #8320
Conversation
…we need. most of it lifted verbatim from that library.
|
||
let expected = 'Hi'; | ||
|
||
assert.dom().hasText(expected, 'capitalizes a single 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 like seeing test messages like these!
assert.dom('h1').hasText('Hello World', 'html string is correctly rendered'); | ||
}); | ||
|
||
test('It safely renders CSS classes from a property', async function (assert) { |
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.
What's an example where this would be used? I've never used any htmlSafe
method on a CSS class before.
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.
Something like
get widthStyle() { | |
const str = `width: ${this.args.percentage}%`; | |
return htmlSafe(str); | |
} |
safe
Ember will escape it to prevent css injection. If you put the class into the template that's fine, but if you attempt to do work on these properties in a getter or some other JS property Ember will call shenanigans.
fixes ilios/ilios#5927