Handle shared attributes object in hyperscript (#1941)

This commit is contained in:
Ilya Sarantsev 2017-08-21 18:55:42 +03:00 committed by Pierre-Yves Gérardy
parent b38367aa30
commit 0986140ed5
3 changed files with 30 additions and 0 deletions

View file

@ -507,6 +507,23 @@ o.spec("hyperscript", function() {
o(vnode.children[0].tag).equals("i")
o(vnode.children[1].tag).equals("s")
})
o("handles shared attrs", function() {
var attrs = {a: "b"}
var nodeA = m(".a", attrs)
var nodeB = m(".b", attrs)
o(nodeA.attrs.className).equals("a")
o(nodeA.attrs.a).equals("b")
o(nodeB.attrs.className).equals("b")
o(nodeB.attrs.a).equals("b")
})
o("doesnt modify passed attributes object", function() {
var attrs = {a: "b"}
m(".a", attrs)
o(attrs).deepEquals({a: "b"})
})
o("handles fragment children without attr unwrapped", function() {
var vnode = m("div", [m("i")], [m("s")])