mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
add notification widget/full system
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { WEnv, Widget } from "../../src/ts/core/widget";
|
||||
import { makeTestWEnv, makeTestFixture } from "../helpers";
|
||||
import { normalize } from "../helpers";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Setup and helpers
|
||||
@@ -573,6 +574,37 @@ describe("composition", () => {
|
||||
"<div><div>0<button>Inc</button></div></div>"
|
||||
);
|
||||
});
|
||||
|
||||
test("sub widgets rendered in a loop", async () => {
|
||||
class ChildWidget extends Widget<WEnv, { n: number }> {
|
||||
name = "c";
|
||||
template = `<span><t t-esc="props.n"/></span>`;
|
||||
}
|
||||
class Parent extends Widget<WEnv, {}> {
|
||||
name = "p";
|
||||
template = `
|
||||
<div>
|
||||
<t t-foreach="state.numbers" t-as="number">
|
||||
<t t-widget="ChildWidget" t-props="{n: number}"/>
|
||||
</t>
|
||||
</div>`;
|
||||
state = {
|
||||
numbers: [1, 2, 3]
|
||||
};
|
||||
widgets = { ChildWidget };
|
||||
}
|
||||
const parent = new Parent(env);
|
||||
await parent.mount(fixture);
|
||||
expect(normalize(fixture.innerHTML)).toBe(
|
||||
normalize(`
|
||||
<div>
|
||||
<span>1</span>
|
||||
<span>2</span>
|
||||
<span>3</span>
|
||||
</div>
|
||||
`)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("props evaluation (with t-props directive)", () => {
|
||||
|
||||
Reference in New Issue
Block a user