feat(framework): make component props reactive
This commit is contained in:
@@ -362,6 +362,20 @@ test("reactive attribute bindings update input and accessibility attributes", ()
|
||||
expect(button.getAttribute("aria-label")).toBe("Hide password");
|
||||
});
|
||||
|
||||
test("parent state updates a mounted child's reactive prop", async () => {
|
||||
const win = mount(
|
||||
`<div data-scope="n: 1">` +
|
||||
`<button data-on-click="n++">increment</button>` +
|
||||
`<div data-scope="value: 1" data-wrn-prop-bind-0='["value","{n}"]'>` +
|
||||
`<span id="child-value" data-text="value">1</span>` +
|
||||
`</div></div>`,
|
||||
);
|
||||
await Promise.resolve();
|
||||
expect(win.document.querySelector("#child-value")?.textContent).toBe("1");
|
||||
(win.document.querySelector("button") as unknown as HTMLElement).click();
|
||||
expect(win.document.querySelector("#child-value")?.textContent).toBe("2");
|
||||
});
|
||||
|
||||
test("independent signals in one scope update correctly (dependency tracking)", () => {
|
||||
const win = mount(
|
||||
`<div data-scope="a: 0, b: 100">
|
||||
|
||||
Reference in New Issue
Block a user