mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] blockdom: fix t-set-slot causing context capture with xml
This is a commit message.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { App, Component, mount, onMounted, useState, xml } from "../../src/index";
|
||||
import { App, Component, mount, onMounted, onRendered, useState, xml } from "../../src/index";
|
||||
import { children, makeTestFixture, nextAppError, nextTick, snapshotEverything } from "../helpers";
|
||||
|
||||
snapshotEverything();
|
||||
@@ -62,6 +62,28 @@ describe("slots", () => {
|
||||
expect(fixture.innerHTML).toBe("some other text");
|
||||
});
|
||||
|
||||
test("t-set-slot doesn't cause context to be captured", async () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<t t-slot="default"/>`;
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static template = xml`<Child>
|
||||
<t t-set-slot="default"><t t-esc="someVal"/></t>
|
||||
</Child>`;
|
||||
static components = { Child };
|
||||
someVal = "some text";
|
||||
setup() {
|
||||
onRendered(() => {
|
||||
this.someVal = "some other text";
|
||||
});
|
||||
}
|
||||
}
|
||||
await mount(Parent, fixture);
|
||||
|
||||
expect(fixture.textContent).toBe("some other text");
|
||||
});
|
||||
|
||||
test("simple slot with slot scope", async () => {
|
||||
let child: any;
|
||||
class Child extends Component {
|
||||
|
||||
Reference in New Issue
Block a user