fix: synchronize forwarded component props
This commit is contained in:
@@ -454,6 +454,22 @@ test("parent state updates a mounted child's reactive prop", async () => {
|
||||
expect(win.document.querySelector("#child-value")?.textContent).toBe("2");
|
||||
});
|
||||
|
||||
test("a prop marker forwarded onto a child control still updates the child scope", async () => {
|
||||
const win = mount(
|
||||
`<div data-scope="enabled: false">` +
|
||||
`<button data-on-click="enabled = true">enable</button>` +
|
||||
`<div data-scope="disabled: true">` +
|
||||
`<button id="child" disabled data-wrn-bind-0='["disabled","{disabled}"]' ` +
|
||||
`data-wrn-prop-bind-0='["disabled","{!enabled}"]'>child</button>` +
|
||||
`</div></div>`,
|
||||
);
|
||||
await Promise.resolve();
|
||||
const buttons = win.document.querySelectorAll("button");
|
||||
expect((buttons[1] as unknown as HTMLButtonElement).disabled).toBe(true);
|
||||
(buttons[0] as unknown as HTMLElement).click();
|
||||
expect((buttons[1] as unknown as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
|
||||
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