Tests for mounting class and factory components
This commit is contained in:
parent
3f3af74dde
commit
9e65e6bf47
1 changed files with 31 additions and 1 deletions
|
|
@ -32,7 +32,17 @@ o.spec("mount", function() {
|
||||||
o(threw).equals(true)
|
o(threw).equals(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("renders into `root`", function() {
|
o("throws on invalid component", function() {
|
||||||
|
var threw = false
|
||||||
|
try {
|
||||||
|
mount(root, {})
|
||||||
|
} catch (e) {
|
||||||
|
threw = true
|
||||||
|
}
|
||||||
|
o(threw).equals(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
o("renders into `root` (POJO component)", function() {
|
||||||
mount(root, {
|
mount(root, {
|
||||||
view : function() {
|
view : function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
|
|
@ -42,6 +52,26 @@ o.spec("mount", function() {
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
o("renders into `root` (class component)", function() {
|
||||||
|
function Cmp(){}
|
||||||
|
Cmp.prototype.view = function(){return m("div")}
|
||||||
|
mount(root, Cmp)
|
||||||
|
|
||||||
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
})
|
||||||
|
|
||||||
|
o("renders into `root` factory (factory component)", function() {
|
||||||
|
mount(root, function(){
|
||||||
|
return {
|
||||||
|
view : function() {
|
||||||
|
return m("div")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
})
|
||||||
|
|
||||||
o("mounting null unmounts", function() {
|
o("mounting null unmounts", function() {
|
||||||
mount(root, {
|
mount(root, {
|
||||||
view : function() {
|
view : function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue