diff --git a/tests/compiler/__snapshots__/svg.test.ts.snap b/tests/compiler/__snapshots__/svg.test.ts.snap index cfecd40f..852b23e4 100644 --- a/tests/compiler/__snapshots__/svg.test.ts.snap +++ b/tests/compiler/__snapshots__/svg.test.ts.snap @@ -27,3 +27,31 @@ exports[`properly support svg add proper namespace to svg 1`] = ` } }" `; + +exports[`properly support svg namespace to g tags not added if already in svg namespace 1`] = ` +"function anonymous(bdom, helpers +) { + let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; + + let block1 = createBlock(\`\`); + + return function template(ctx, node, key = \\"\\") { + return block1(); + } +}" +`; + +exports[`properly support svg namespace to svg tags added even if already in svg namespace 1`] = ` +"function anonymous(bdom, helpers +) { + let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; + + let block1 = createBlock(\`\`); + + return function template(ctx, node, key = \\"\\") { + return block1(); + } +}" +`; diff --git a/tests/compiler/svg.test.ts b/tests/compiler/svg.test.ts index ff450a08..b4d1fce0 100644 --- a/tests/compiler/svg.test.ts +++ b/tests/compiler/svg.test.ts @@ -1,8 +1,9 @@ import { renderToString, snapshotEverything } from "../helpers"; +// NB: check the snapshots to see where the SVG namespaces are added snapshotEverything(); -describe.only("properly support svg", () => { +describe("properly support svg", () => { test("add proper namespace to svg", () => { const template = ` `; expect(renderToString(template)).toBe( @@ -11,10 +12,19 @@ describe.only("properly support svg", () => { }); test("add proper namespace to g tags", () => { - // this is necessary if one wants to use components in a svg const template = ` `; expect(renderToString(template)).toBe( ` ` ); }); + + test("namespace to g tags not added if already in svg namespace", () => { + const template = ``; + expect(renderToString(template)).toBe(``); + }); + + test("namespace to svg tags added even if already in svg namespace", () => { + const template = ``; + expect(renderToString(template)).toBe(``); + }); });