Tests: factory => closure components
This commit is contained in:
parent
d7f39a8254
commit
a8e5189f0b
3 changed files with 6 additions and 5 deletions
|
|
@ -60,7 +60,7 @@ o.spec("mount", function() {
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
})
|
})
|
||||||
|
|
||||||
o("renders into `root` factory (factory component)", function() {
|
o("renders into `root` (closure component)", function() {
|
||||||
mount(root, function(){
|
mount(root, function(){
|
||||||
return {
|
return {
|
||||||
view : function() {
|
view : function() {
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ o.spec("route", function() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
o("routed mount points can redraw synchronously (factory component)", function() {
|
o("routed mount points can redraw synchronously (closure component)", function() {
|
||||||
var view = o.spy()
|
var view = o.spy()
|
||||||
|
|
||||||
function Cmp() {return {view: view}}
|
function Cmp() {return {view: view}}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
var o = require("../../ospec/ospec")
|
var o = require("../../ospec/ospec")
|
||||||
|
var components = require("../../test-utils/components")
|
||||||
var domMock = require("../../test-utils/domMock")
|
var domMock = require("../../test-utils/domMock")
|
||||||
var vdom = require("../../render/render")
|
var vdom = require("../../render/render")
|
||||||
|
|
||||||
|
|
@ -118,7 +119,7 @@ o.spec("render", function() {
|
||||||
o(oninit.callCount).equals(0)
|
o(oninit.callCount).equals(0)
|
||||||
o(onbeforeupdate.callCount).equals(0)
|
o(onbeforeupdate.callCount).equals(0)
|
||||||
})
|
})
|
||||||
o("does not try to re-initialize a factory component whose view has thrown", function() {
|
o("does not try to re-initialize a closure component whose view has thrown", function() {
|
||||||
var oninit = o.spy()
|
var oninit = o.spy()
|
||||||
var onbeforeupdate = o.spy()
|
var onbeforeupdate = o.spy()
|
||||||
function A() {
|
function A() {
|
||||||
|
|
@ -141,7 +142,7 @@ o.spec("render", function() {
|
||||||
o(oninit.callCount).equals(1)
|
o(oninit.callCount).equals(1)
|
||||||
o(onbeforeupdate.callCount).equals(0)
|
o(onbeforeupdate.callCount).equals(0)
|
||||||
})
|
})
|
||||||
o("does not try to re-initialize a factory component whose oninit has thrown", function() {
|
o("does not try to re-initialize a closure component whose oninit has thrown", function() {
|
||||||
var oninit = o.spy(function(vnode) {throw new Error("error")})
|
var oninit = o.spy(function(vnode) {throw new Error("error")})
|
||||||
var onbeforeupdate = o.spy()
|
var onbeforeupdate = o.spy()
|
||||||
function A() {
|
function A() {
|
||||||
|
|
@ -164,7 +165,7 @@ o.spec("render", function() {
|
||||||
o(oninit.callCount).equals(1)
|
o(oninit.callCount).equals(1)
|
||||||
o(onbeforeupdate.callCount).equals(0)
|
o(onbeforeupdate.callCount).equals(0)
|
||||||
})
|
})
|
||||||
o("does not try to re-initialize a factory component whose factory has thrown", function() {
|
o("does not try to re-initialize a closure component whose closure has thrown", function() {
|
||||||
function A() {
|
function A() {
|
||||||
throw new Error("error")
|
throw new Error("error")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue