(div2 = el)} />
(p = el)}>
(div3 = el)} />
,
);
});
[svg, svg2, svg3, svg4].forEach(el => {
expect(el.namespaceURI).toBe('http://www.w3.org/2000/svg');
// SVG tagName is case sensitive.
expect(el.tagName).toBe('svg');
});
expect(g.namespaceURI).toBe('http://www.w3.org/2000/svg');
expect(g.tagName).toBe('g');
expect(g.getAttribute('stroke-width')).toBe('5');
expect(p.namespaceURI).toBe('http://www.w3.org/1999/xhtml');
// DOM tagName is capitalized by browsers.
expect(p.tagName).toBe('P');
[image, image2, image3].forEach(el => {
expect(el.namespaceURI).toBe('http://www.w3.org/2000/svg');
expect(el.tagName).toBe('image');
expect(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href')).toBe(
'http://i.imgur.com/w7GCRPb.png',
);
});
[foreignObject, foreignObject2].forEach(el => {
expect(el.namespaceURI).toBe('http://www.w3.org/2000/svg');
expect(el.tagName).toBe('foreignObject');
});
[div, div2, div3].forEach(el => {
expect(el.namespaceURI).toBe('http://www.w3.org/1999/xhtml');
expect(el.tagName).toBe('DIV');
});
});
it('creates elements with SVG namespace inside SVG tag during update', async () => {
let inst,
div,
div2,
foreignObject,
foreignObject2,
g,
image,
image2,
svg,
svg2,
svg3,
svg4;
class App extends React.Component {
state = {step: 0};
render() {
inst = this;
const {step} = this.state;
if (step === 0) {
return null;
}
return (
(g = el)} strokeWidth="5">