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

Add documentation how to use safe components in tests #923

Merged
merged 1 commit into from
Aug 21, 2021

Conversation

mydea
Copy link
Contributor

@mydea mydea commented Aug 18, 2021

This PR adds a section to the safe component helper usage docs on how to use it in tests. It took me a bit to figure it out, so I figured it might help others to have this in there!

@ef4
Copy link
Contributor

ef4 commented Aug 18, 2021

Thanks, this looks good.

Just wanted to mention that this is an area that gets nicer as soon as we have a syntax for strict mode templates. For example, with GJS (which you can try already with https://github.com/ember-template-imports/ember-template-imports) your example becomes:

import Component from '@glimmer/component';

test('my test', async function(assert) {
  this.testComponent = <template>Test content: {{@message}}</template>;
  await render(hbs`
    <MyComponent @display={{this.testComponent}} />
  `);
});

We don't need to show that in the docs yet as it's nonstandard. But that's where the design is heading.

REPLACING-COMPONENT-HELPER.md Outdated Show resolved Hide resolved
@ef4 ef4 merged commit 4f3f7f8 into embroider-build:master Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants