[test-utils/domMock] improve attributes handling

This commit is contained in:
Pierre-Yves Gerardy 2017-05-27 00:38:25 +02:00
parent 7ee4e002f3
commit e031fe49a1
9 changed files with 450 additions and 100 deletions

View file

@ -24,8 +24,8 @@ o.spec("createElement", function() {
render(root, [vnode])
o(vnode.dom.nodeName).equals("DIV")
o(vnode.dom.attributes["id"].nodeValue).equals("a")
o(vnode.dom.attributes["title"].nodeValue).equals("b")
o(vnode.dom.attributes["id"].value).equals("a")
o(vnode.dom.attributes["title"].value).equals("b")
})
o("creates style", function() {
var vnode = {tag: "div", attrs: {style: {backgroundColor: "red"}}}
@ -48,8 +48,8 @@ o.spec("createElement", function() {
render(root, [vnode])
o(vnode.dom.nodeName).equals("DIV")
o(vnode.dom.attributes["id"].nodeValue).equals("a")
o(vnode.dom.attributes["title"].nodeValue).equals("b")
o(vnode.dom.attributes["id"].value).equals("a")
o(vnode.dom.attributes["title"].value).equals("b")
o(vnode.dom.childNodes.length).equals(2)
o(vnode.dom.childNodes[0].nodeName).equals("A")
o(vnode.dom.childNodes[1].nodeName).equals("B")
@ -65,7 +65,7 @@ o.spec("createElement", function() {
o(vnode.dom.namespaceURI).equals("http://www.w3.org/2000/svg")
o(vnode.dom.firstChild.nodeName).equals("a")
o(vnode.dom.firstChild.namespaceURI).equals("http://www.w3.org/2000/svg")
o(vnode.dom.firstChild.attributes["href"].nodeValue).equals("javascript:;")
o(vnode.dom.firstChild.attributes["href"].value).equals("javascript:;")
o(vnode.dom.firstChild.attributes["href"].namespaceURI).equals("http://www.w3.org/1999/xlink")
o(vnode.dom.childNodes[1].nodeName).equals("foreignObject")
o(vnode.dom.childNodes[1].firstChild.nodeName).equals("body")
@ -75,7 +75,7 @@ o.spec("createElement", function() {
var vnode = {tag: "svg", ns: "http://www.w3.org/2000/svg", attrs: {viewBox: "0 0 100 100"}}
render(root, [vnode])
o(vnode.dom.attributes["viewBox"].nodeValue).equals("0 0 100 100")
o(vnode.dom.attributes["viewBox"].value).equals("0 0 100 100")
})
o("creates mathml", function() {
var vnode = {tag: "math", ns: "http://www.w3.org/1998/Math/MathML", children: [{tag: "mrow", ns: "http://www.w3.org/1998/Math/MathML"}]}