Open
Description
The closest I'm seeing is this example, but it has some issues:
- Only
model
can be updated, which would require us to change our components frominput
for anything we want to test, which is not ideal - Manually interacting with the underlying values like that is testing implementation details
- The template syntax in
render
doesn't expose an underlying componentRef to callsetInput
on
In an ideal world, the template will automatically update when the signal changes, like we'd expect in angular template HTML:
Preferred API:
it("should render text from a signal", async () => {
const someSignal = signal("hello");
await render(
html`<span data-testid="value">{{ someSignal() }} world</span>`,
{
componentProperties: {
someSignal,
},
},
);
// Passes
expect(screen.getByTestId("value")).toHaveTextContent("hello world");
someSignal.set("updated");
// Fails
expect(screen.getByTestId("value")).toHaveTextContent("updated world");
});
Metadata
Metadata
Assignees
Labels
No labels