expect(element.ns).toBe(Namespaces.SVG)
})
+ test('SVG tags without explicit root', () => {
+ const ast = parse('<text/><view/><tspan/>', parserOptions)
+ const textNode = ast.children[0] as ElementNode
+ const viewNode = ast.children[1] as ElementNode
+ const tspanNode = ast.children[2] as ElementNode
+
+ expect(textNode.ns).toBe(Namespaces.SVG)
+ expect(viewNode.ns).toBe(Namespaces.SVG)
+ expect(tspanNode.ns).toBe(Namespaces.SVG)
+ })
+
test('MATH in HTML namespace', () => {
const ast = parse('<html><math></math></html>', parserOptions)
const elementHtml = ast.children[0] as ElementNode
expect(element.ns).toBe(Namespaces.MATH_ML)
})
+ test('MATH tags without explicit root', () => {
+ const ast = parse('<mi/><mn/><mo/>', parserOptions)
+ const miNode = ast.children[0] as ElementNode
+ const mnNode = ast.children[1] as ElementNode
+ const moNode = ast.children[2] as ElementNode
+
+ expect(miNode.ns).toBe(Namespaces.MATH_ML)
+ expect(mnNode.ns).toBe(Namespaces.MATH_ML)
+ expect(moNode.ns).toBe(Namespaces.MATH_ML)
+ })
+
test('root ns', () => {
const ast = parse('<foreignObject><test/></foreignObject>', {
...parserOptions,