mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] qweb: compiler: support t-key on node and component without t-foreach
This commit is contained in:
committed by
Géry Debongnie
parent
779fc6b02b
commit
ae71db28e4
@@ -2108,7 +2108,7 @@ test("concurrent renderings scenario 16", async () => {
|
||||
// });
|
||||
|
||||
// TODO: unskip when t-key is reimplemented properly
|
||||
test.skip("calling render in destroy", async () => {
|
||||
test("calling render in destroy", async () => {
|
||||
const steps: any[] = [];
|
||||
|
||||
let a: any = null;
|
||||
@@ -2165,7 +2165,7 @@ test.skip("calling render in destroy", async () => {
|
||||
// this nextTick is critical, otherwise jest may silently swallow errors
|
||||
await nextTick();
|
||||
|
||||
expect(steps).toBe(["B:mounted", "B:willUnmount", "B:mounted"]);
|
||||
expect(steps).toStrictEqual(["B:mounted", "B:willUnmount", "B:mounted"]);
|
||||
expect(fixture.innerHTML).toBe("<div>A</div>");
|
||||
});
|
||||
|
||||
@@ -2302,7 +2302,7 @@ test("render method wait until rendering is done", async () => {
|
||||
|
||||
test("two renderings initiated between willPatch and patched", async () => {
|
||||
let parent: any = null;
|
||||
let steps: string[] = [];
|
||||
const steps: string[] = [];
|
||||
|
||||
class Panel extends Component {
|
||||
static template = xml`<abc><t t-esc="props.val"/></abc>`;
|
||||
@@ -2325,17 +2325,8 @@ test("two renderings initiated between willPatch and patched", async () => {
|
||||
}
|
||||
|
||||
await mount(Parent, fixture);
|
||||
|
||||
expect(fixture.innerHTML).toBe("<div><abc>Panel1</abc></div>");
|
||||
|
||||
parent.state.panel = "Panel2";
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("<div><abc>Panel2</abc></div>");
|
||||
|
||||
parent.state.flag = false;
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("<div></div>");
|
||||
|
||||
expect(steps).toEqual([
|
||||
"Parent:setup",
|
||||
"Parent:willStart",
|
||||
@@ -2345,13 +2336,31 @@ test("two renderings initiated between willPatch and patched", async () => {
|
||||
"Panel:render",
|
||||
"Panel:mounted",
|
||||
"Parent:mounted",
|
||||
]);
|
||||
steps.length = 0;
|
||||
|
||||
parent.state.panel = "Panel2";
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("<div><abc>Panel2</abc></div>");
|
||||
|
||||
expect(steps).toEqual([
|
||||
"Parent:render",
|
||||
"Panel:willUpdateProps",
|
||||
"Panel:setup",
|
||||
"Panel:willStart",
|
||||
"Panel:render",
|
||||
"Parent:willPatch",
|
||||
"Panel:willPatch",
|
||||
"Panel:patched",
|
||||
"Panel:willUnmount",
|
||||
"Panel:destroyed",
|
||||
"Panel:mounted",
|
||||
"Parent:patched",
|
||||
]);
|
||||
steps.length = 0;
|
||||
|
||||
parent.state.flag = false;
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("<div></div>");
|
||||
|
||||
expect(steps).toEqual([
|
||||
"Parent:render",
|
||||
"Parent:willPatch",
|
||||
"Panel:willUnmount",
|
||||
|
||||
Reference in New Issue
Block a user