Tests use hyperscript instead of manually constructing nodes

This commit is contained in:
Barney Carroll 2021-04-14 17:05:14 +01:00 committed by Stephan Hoyer
parent 5502570b16
commit 31d2ed4be8
27 changed files with 1515 additions and 1841 deletions

View file

@ -3,6 +3,9 @@
var o = require("ospec")
var domMock = require("../../test-utils/domMock")
var vdom = require("../../render/render")
var m = require("../../render/hyperscript")
m.fragment = require("../../render/fragment")
m.trust = require("../../render/trust")
o.spec("createNodes", function() {
var $window, root, render
@ -14,10 +17,10 @@ o.spec("createNodes", function() {
o("creates nodes", function() {
var vnodes = [
{tag: "a"},
{tag: "#", children: "b"},
{tag: "<", children: "c"},
{tag: "[", children: [{tag: "#", children: "d"}]},
m("a"),
"b",
m.trust("c"),
m.fragment("d"),
]
render(root, vnodes)
@ -29,11 +32,11 @@ o.spec("createNodes", function() {
})
o("ignores null", function() {
var vnodes = [
{tag: "a"},
{tag: "#", children: "b"},
m("a"),
"b",
null,
{tag: "<", children: "c"},
{tag: "[", children: [{tag: "#", children: "d"}]},
m.trust("c"),
m.fragment("d"),
]
render(root, vnodes)
@ -45,11 +48,11 @@ o.spec("createNodes", function() {
})
o("ignores undefined", function() {
var vnodes = [
{tag: "a"},
{tag: "#", children: "b"},
m("a"),
"b",
undefined,
{tag: "<", children: "c"},
{tag: "[", children: [{tag: "#", children: "d"}]},
m.trust("c"),
m.fragment("d"),
]
render(root, vnodes)