Additional namespace tests for SVG foreignObject case

pull/133/head
Harry Wincup 9 years ago
parent 258c8b91da
commit 68d878c274

@ -73,8 +73,21 @@ describe('snabbdom', function() {
assert.equal(elm.firstChild.id, 'unique'); assert.equal(elm.firstChild.id, 'unique');
}); });
it('has correct namespace', function() { it('has correct namespace', function() {
elm = patch(vnode0, h('div', [h('div', {ns: 'http://www.w3.org/2000/svg'})])).elm; var SVGNamespace = 'http://www.w3.org/2000/svg';
assert.equal(elm.firstChild.namespaceURI, 'http://www.w3.org/2000/svg'); var XHTMLNamespace = 'http://www.w3.org/1999/xhtml';
elm = patch(vnode0, h('div', [h('div', {ns: SVGNamespace})])).elm;
assert.equal(elm.firstChild.namespaceURI, SVGNamespace);
elm = patch(vnode0, h('svg', [
h('foreignObject', [
h('div', ['I am HTML embedded in SVG'])
])
])).elm;
assert.equal(elm.namespaceURI, SVGNamespace);
assert.equal(elm.firstChild.namespaceURI, SVGNamespace);
assert.equal(elm.firstChild.firstChild.namespaceURI, XHTMLNamespace);
}); });
it('is recieves classes in selector', function() { it('is recieves classes in selector', function() {
elm = patch(vnode0, h('div', [h('i.am.a.class')])).elm; elm = patch(vnode0, h('div', [h('i.am.a.class')])).elm;

Loading…
Cancel
Save