-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Introduce new test helpers for rendering (and re-rendering) that obviate the need for get
and set
#785
Introduce new test helpers for rendering (and re-rendering) that obviate the need for get
and set
#785
Conversation
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
Co-authored-by: Robert Jackson <me@rwjblue.com>
Thank you, @cafreeman – I’m really excited about this! |
What is the difference between |
I fully agree that I wonder about the name of the function,
Would be replaced with something like:
For me, as a learner, the top line clicks right away because the On the other hand, "await the render of this scoped template" forces me to think about why it's important that the template is scoped, and "because it's scoped, it has access to |
@muziejus—it is indeed a bit of a longer name! @cafreeman, @rwjblue, and I talked about it a fair bit while @cafreeman was drafting this originally. There’s certainly some room for bike-shedding here, but the name is intentionally designed to communicate the difference with classic Footnotes
|
Instead of 'forthcoming RFC', link directly to emberjs#785!
Looking forward to this! Some questions though:
|
@chriskrycho why have an intermediate step between |
Because it means the two aren’t coupled to each other—not for acceptance of the RFCs or for their implementations. If it happens that #779 gets accepted before this does, then we can revise this in terms of it if we so desire. But even then that may not be desireable because it means you are blocked on all the tooling being done and ready. |
|
I have example of what this PR implies along with 🎉 |
get
/set
in test contextsget
and set
Super minor, but I assume we should also update some blueprints as part of this effort?
|
Chatted with @cafreeman about this last week, I think we are in a pretty good spot to pick this RFC back up (now that first class @cafreeman - I'm gonna move this into "draft" (since we know there are some tweaks that are needed) and you can move it back to ready for review once updated, then I'll try to make sure to get this on the agenda for discussion / forward progress. |
Now that First-Class Component Templates have landed(🎉 ), I've updated the RFC to use the |
@rwjblue Moving this back to "ready for review" now that it's been updated. |
Thank you!! I'll work to get this on an upcoming core team agenda... |
We discussed this at the core team meeting on Friday (2022-04-01), and are generally all in favor of moving forward. There are just a few tweaks/changes that we'd like to see made:
Passing Arguments Detailstest('it works', async function (assert) {
const args = await renderComponent(
<template>
<ProfileCard @name={{@name}} @age={{@age}} />
</template>,
{
name: "Zoey",
age: 5,
}
);
assert.dom(this.element).hasText('Zoey');
args.name = 'Zoeyyyyyyyyyyyyy'
await rerender();
assert.dom(this.element).hasText('Zoeyyyyyyyyyyyyy');
}); The current design as written in the RFC still fundamentally must work so there is no risk about this RFC introducing something we actively want to remove, but a design like ^ would be a bit nicer to teach in our opinion. @cafreeman - Iterating this RFC for ^ or just moving forward as written and updating the prose to refer to a future RFC that will add support for leveraging named arguments is totally fine, totally up to you -- we are happy to do whichever you prefer. |
8ce0218
to
976036d
Compare
I like this proposal, just want to highlight a possible problem and possible way to address it. I can already see a lot of people forgetting to use this new Could we potentially warn users about pending render operations whenever they do an |
976036d
to
040af6f
Compare
We talked about this at today’s Framework Core team meeting and are moving it forward into Final Comment Period! |
We discussed this again at today's Framework meeting and are merging it! |
As part of the larger initiative to support TypeScript in Ember, this PR proposes that we provide a new set of test helpers that removes the need to
get
andset
values on thethis
values in tests. This change would benefit all Ember developers, but would especially help TypeScript users because of how much it would simplify the type-checking in component tests.rendered