Tests for routes that resolve to class and factory components

This commit is contained in:
Pierre-Yves Gerardy 2017-02-15 21:48:28 +01:00
parent 9e65e6bf47
commit f4fb5ac4be

View file

@ -51,7 +51,7 @@ o.spec("route", function() {
o(root.firstChild.nodeName).equals("DIV")
})
o("routed mount points can redraw synchronously (#1275)", function() {
o("routed mount points can redraw synchronously (POJO component)", function() {
var view = o.spy()
$window.location.href = prefix + "/"
@ -65,6 +65,39 @@ o.spec("route", function() {
})
o("routed mount points can redraw synchronously (constructible component)", function() {
var view = o.spy()
var Cmp = function(){}
Cmp.prototype.view = view
$window.location.href = prefix + "/"
route(root, "/", {"/":Cmp})
o(view.callCount).equals(1)
redrawService.redraw()
o(view.callCount).equals(2)
})
o("routed mount points can redraw synchronously (factory component)", function() {
var view = o.spy()
function Cmp() {return {view: view}}
$window.location.href = prefix + "/"
route(root, "/", {"/":Cmp})
o(view.callCount).equals(1)
redrawService.redraw()
o(view.callCount).equals(2)
})
o("default route doesn't break back button", function(done) {
$window.location.href = "http://old.com"
$window.location.href = "http://new.com"