Improve hyperscript test coverage (#1250)
This commit is contained in:
parent
a3c273f802
commit
6ae4e22446
1 changed files with 18 additions and 0 deletions
|
|
@ -3,6 +3,12 @@ var m = require("../../render/hyperscript")
|
|||
|
||||
o.spec("hyperscript", function() {
|
||||
o.spec("selector", function() {
|
||||
o("throws on null selector", function(done) {
|
||||
try {m(null)} catch(e) {done()}
|
||||
})
|
||||
o("throws on non-string selector w/o a view property", function(done) {
|
||||
try {m({})} catch(e) {done()}
|
||||
})
|
||||
o("handles tag in selector", function() {
|
||||
var vnode = m("a")
|
||||
|
||||
|
|
@ -159,6 +165,13 @@ o.spec("hyperscript", function() {
|
|||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(false)
|
||||
})
|
||||
o("handles only key in attrs", function() {
|
||||
var vnode = m("div", {key:"a"})
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs).equals(undefined)
|
||||
o(vnode.key).equals("a")
|
||||
})
|
||||
o("handles many attrs", function() {
|
||||
var vnode = m("div", {a: "b", c: "d"})
|
||||
|
||||
|
|
@ -166,6 +179,11 @@ o.spec("hyperscript", function() {
|
|||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
})
|
||||
o("handles className attrs property", function() {
|
||||
var vnode = m("div", {className: "a"})
|
||||
|
||||
o(vnode.attrs.className).equals("a")
|
||||
})
|
||||
o("handles merging classes w/ class property", function() {
|
||||
var vnode = m(".a", {class: "b"})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue