-
Notifications
You must be signed in to change notification settings - Fork 40
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
using <template> in tests, how to rerender with an updated parameter #189
Comments
Param isn't tracked -- this is what i do: test('with a value', async function (assert) {
class State {
@tracked value = 0;
}
let state = new State();
await render(
<template>
<Progress @value={{state.value}} as |x|>
<div id="value">{{x.value}}</div>
<div id="percent">{{x.percent}}</div>
<x.Indicator />
</Progress>
</template>
);
You could also use cell, TrackedObject, etc |
Allllso, you can replace assert.dom(this.element) With assert.dom()
|
Yes, I had suggested the class above. What should we be teaching as the recommended way? Guides prob needed updated to let people know.
This was just an example test and was generated from blueprints, so blueprints should be updated. |
yeah, the guides are still "Octane", and become less and less relevant as we move towards polaris -- the guides will need a big overhaul before we declare polaris released tho.
yes |
In tests, when using hbs, you can update a param with set, rerender and get the change.
given as TestComponent2
you can do this test and it works.
Since the context is changed for gjs, the following test does not work.
Cant really use set or notifyPropertyChange as the param is not on an object to pass. One way I see is to create a class with param tracked but that seems overkill for tests from what we had before.
What is the recommended way to write tests that update params when using
<template>
in tests?The text was updated successfully, but these errors were encountered: