add integration test

This commit is contained in:
Leo Horie 2016-12-04 23:36:38 -05:00
parent 2ffd2fb7e4
commit a2b45ff131
2 changed files with 24 additions and 1 deletions

View file

@ -609,6 +609,29 @@ o.spec("route", function() {
}, 30) }, 30)
}) })
o("route changes activate onbeforeremove", function(done, timeout) {
var spy = o.spy()
$window.location.href = prefix + "/a"
route(root, "/a", {
"/a": {
onbeforeremove: spy,
view: function() {}
},
"/b": {
view: function() {}
}
})
route.set("/b")
setTimeout(function() {
o(spy.callCount).equals(1)
done()
}, 30)
})
o("throttles", function(done, timeout) { o("throttles", function(done, timeout) {
timeout(200) timeout(200)

View file

@ -8,7 +8,7 @@ o.spec("api", function() {
var FRAME_BUDGET = Math.floor(1000 / 60) var FRAME_BUDGET = Math.floor(1000 / 60)
o.beforeEach(function() { o.beforeEach(function() {
var mock = browserMock() var mock = browserMock()
if (typeof global !== "undefined") global.window = mock, global.document = mock.document if (typeof global !== "undefined") global.window = mock
m = require("../mithril") m = require("../mithril")
}) })