mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] refs in recursive templates now work properly
This commit is contained in:
committed by
Samuel Degueldre
parent
74faa8bb82
commit
a9f29c4caa
@@ -1,4 +1,5 @@
|
||||
import { createBlock, mount, patch, remove } from "../../src/blockdom";
|
||||
import { logStep } from "../helpers";
|
||||
import { makeTestFixture } from "./helpers";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -55,3 +56,15 @@ test("is in dom when callback is called", async () => {
|
||||
|
||||
mount(tree, fixture);
|
||||
});
|
||||
|
||||
test("callback ref in callback ref with same block", async () => {
|
||||
const block = createBlock('<p block-ref="0"><block-text-1/><block-child-0/></p>');
|
||||
let refFn = (el: HTMLParagraphElement) => logStep(el.outerHTML);
|
||||
|
||||
const child = block([refFn, "child"], []);
|
||||
const parent = block([refFn, "parent"], [child]);
|
||||
mount(parent, fixture);
|
||||
|
||||
expect(fixture.innerHTML).toBe("<p>parent<p>child</p></p>");
|
||||
expect(["<p>child</p>", "<p>parent<p>child</p></p>"]).toBeLogged();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user