diff --git a/tests/component/component.test.ts b/tests/component/component.test.ts index c633af74..696c13e1 100644 --- a/tests/component/component.test.ts +++ b/tests/component/component.test.ts @@ -2670,6 +2670,46 @@ describe("other directives with t-component", () => { await nextTick(); // wait for changes triggered in mounted to be applied expect(fixture.innerHTML).toBe("
B0B1
"); }); + + test("t-set outside modified in t-foreach", async () => { + class SomeWidget extends Component { + static template = xml` +
+ + +

InLoop:

+ + +

EndLoop:

+
`; + + state = useState({values: ['a', 'b']}); + } + const widget = new SomeWidget(); + await widget.mount(fixture); + + expect(fixture.innerHTML).toBe("

Inloop: 0

Inloop: 1

EndLoop: 2

"); + }); + + test("t-set outside modified in t-foreach increment operator", async () => { + class SomeWidget extends Component { + static template = xml` +
+ + +

InLoop:

+ + +

EndLoop:

+
`; + + state = useState({values: ['a', 'b']}); + } + const widget = new SomeWidget(); + await widget.mount(fixture); + + expect(fixture.innerHTML).toBe("

Inloop: 0

Inloop: 1

EndLoop: 2

"); + }); }); describe("random stuff/miscellaneous", () => {