mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
dd
This commit is contained in:
@@ -52,6 +52,35 @@ exports[`properly support svg namespace to svg tags added even if already in svg
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`properly support svg svg namespace added to sub-blocks (t-call) 1`] = `
|
||||||
|
"function anonymous(bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||||
|
let { getTemplate } = helpers;
|
||||||
|
const callTemplate_1 = getTemplate(\`path\`);
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><block-child-0/></svg>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
let b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
|
return block1([], [b2]);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`properly support svg svg namespace added to sub-blocks (t-call) 2`] = `
|
||||||
|
"function anonymous(bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<path/>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`properly support svg svg namespace added to sub-blocks 1`] = `
|
exports[`properly support svg svg namespace added to sub-blocks 1`] = `
|
||||||
"function anonymous(bdom, helpers
|
"function anonymous(bdom, helpers
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { renderToString, renderToBdom, snapshotEverything, makeTestFixture } from "../helpers";
|
import { renderToString, renderToBdom, snapshotEverything, makeTestFixture } from "../helpers";
|
||||||
import { mount } from "../../src/blockdom";
|
import { mount } from "../../src/blockdom";
|
||||||
|
import { mount as mountComponent, Component } from "../../src/index"
|
||||||
|
|
||||||
// NB: check the snapshots to see where the SVG namespaces are added
|
// NB: check the snapshots to see where the SVG namespaces are added
|
||||||
snapshotEverything();
|
snapshotEverything();
|
||||||
|
|
||||||
@@ -52,4 +54,24 @@ describe("properly support svg", () => {
|
|||||||
expect(el.namespaceURI).toBe("http://www.w3.org/2000/svg");
|
expect(el.namespaceURI).toBe("http://www.w3.org/2000/svg");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.only("svg namespace added to sub-blocks (t-call)", async () => {
|
||||||
|
const templates = `<t>
|
||||||
|
<t t-name="svg"><svg><t t-call="path" /></svg></t>
|
||||||
|
<t t-name="path"><path /></t>
|
||||||
|
</t>
|
||||||
|
`
|
||||||
|
const fixture = makeTestFixture();
|
||||||
|
|
||||||
|
class Svg extends Component {
|
||||||
|
static template = "svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
await mountComponent(Svg, fixture, {templates})
|
||||||
|
const elems = fixture.querySelectorAll("svg, path");
|
||||||
|
expect(elems.length).toEqual(2);
|
||||||
|
for (const el of elems) {
|
||||||
|
expect(el.namespaceURI).toBe("http://www.w3.org/2000/svg");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user