Skip to content
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

Merged

Conversation

stopfstedt
Copy link
Member


let expected = 'Hi';

assert.dom().hasText(expected, 'capitalizes a single string');
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Member

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);
}
where if we don't mark the string as 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.

@dartajax dartajax added the run ui tests Run the expensive UI tests label Jan 21, 2025
@dartajax dartajax merged commit 63ebfd1 into ilios:master Jan 21, 2025
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run ui tests Run the expensive UI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

replace dependency on ember-cli-string-helpers
4 participants