diff --git a/tests/compiler/__snapshots__/svg.test.ts.snap b/tests/compiler/__snapshots__/svg.test.ts.snap index 2161f05a..7bb81ec8 100644 --- a/tests/compiler/__snapshots__/svg.test.ts.snap +++ b/tests/compiler/__snapshots__/svg.test.ts.snap @@ -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(\`\`); + + 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(\`\`); + + return function template(ctx, node, key = \\"\\") { + return block1(); + } +}" +`; + exports[`properly support svg svg namespace added to sub-blocks 1`] = ` "function anonymous(bdom, helpers ) { diff --git a/tests/compiler/svg.test.ts b/tests/compiler/svg.test.ts index a56aa348..c98fd2bb 100644 --- a/tests/compiler/svg.test.ts +++ b/tests/compiler/svg.test.ts @@ -1,5 +1,7 @@ import { renderToString, renderToBdom, snapshotEverything, makeTestFixture } from "../helpers"; 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 snapshotEverything(); @@ -52,4 +54,24 @@ describe("properly support svg", () => { expect(el.namespaceURI).toBe("http://www.w3.org/2000/svg"); } }); + + test.only("svg namespace added to sub-blocks (t-call)", async () => { + const templates = ` + + + + ` + 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"); + } + }); });