mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] app: improve API, small refactoring
This commit is contained in:
committed by
Aaron Bohy
parent
772c275bd4
commit
aad6b806ba
@@ -41,7 +41,7 @@ describe("basics", () => {
|
||||
static template = xml`<span><t t-esc="props.value"/></span>`;
|
||||
}
|
||||
|
||||
const app = new App(Test, { value: 3 });
|
||||
const app = new App(Test, { props: { value: 3 } });
|
||||
const component = await app.mount(fixture);
|
||||
|
||||
expect(fixture.innerHTML).toBe("<span>3</span>");
|
||||
@@ -125,7 +125,7 @@ describe("basics", () => {
|
||||
}
|
||||
}
|
||||
|
||||
const app = new App(Test, p);
|
||||
const app = new App(Test, { props: p });
|
||||
await app.mount(fixture);
|
||||
});
|
||||
|
||||
@@ -819,6 +819,16 @@ describe("mount targets", () => {
|
||||
expect(fixture.innerHTML).toBe("<span></span><div>app</div>");
|
||||
});
|
||||
|
||||
test("mount function: can mount a component (with default position='last-child')", async () => {
|
||||
class Root extends Component {
|
||||
static template = xml`<div>app</div>`;
|
||||
}
|
||||
const span = document.createElement("span");
|
||||
fixture.appendChild(span);
|
||||
await mount(Root, fixture, { position: "last-child" });
|
||||
expect(fixture.innerHTML).toBe("<span></span><div>app</div>");
|
||||
});
|
||||
|
||||
test("default mount option is 'last-child'", async () => {
|
||||
class Root extends Component {
|
||||
static template = xml`<div>app</div>`;
|
||||
|
||||
Reference in New Issue
Block a user