components, angular dbmon
This commit is contained in:
parent
ba378d3652
commit
3282ef3f77
30 changed files with 1270 additions and 248 deletions
58
render/tests/test-normalize.js
Normal file
58
render/tests/test-normalize.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var Node = require("../../render/node")
|
||||
|
||||
o.spec("normalize", function() {
|
||||
o("normalizes array into fragment", function() {
|
||||
var node = Node.normalize([])
|
||||
|
||||
o(node.tag).equals("[")
|
||||
o(node.children.length).equals(0)
|
||||
})
|
||||
o("normalizes nested array into fragment", function() {
|
||||
var node = Node.normalize([[]])
|
||||
|
||||
o(node.tag).equals("[")
|
||||
o(node.children.length).equals(1)
|
||||
o(node.children[0].tag).equals("[")
|
||||
o(node.children[0].children.length).equals(0)
|
||||
})
|
||||
o("normalizes string into text node", function() {
|
||||
var node = Node.normalize("a")
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals("a")
|
||||
})
|
||||
o("normalizes falsy string into text node", function() {
|
||||
var node = Node.normalize("")
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals("")
|
||||
})
|
||||
o("normalizes number into text node", function() {
|
||||
var node = Node.normalize(1)
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(1)
|
||||
})
|
||||
o("normalizes falsy number into text node", function() {
|
||||
var node = Node.normalize(0)
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(0)
|
||||
})
|
||||
o("normalizes boolean into text node", function() {
|
||||
var node = Node.normalize(true)
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(true)
|
||||
})
|
||||
o("normalizes falsy boolean into text node", function() {
|
||||
var node = Node.normalize(false)
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(false)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue