diff --git a/api/tests/async.js b/api/tests/async.js deleted file mode 100644 index f3206fd7..00000000 --- a/api/tests/async.js +++ /dev/null @@ -1,46 +0,0 @@ -var _fns = [] -var _last = 0 -var _frame = 1000 / 60 - -module.exports = { - setTimeout : function($window) { - $window.setTimeout = typeof window === "object" ? window.setTimeout : global.setTimeout; - $window.clearTimeout = typeof window === "object" ? window.clearTimeout : global.setTimeout; - }, - - requestAnimationFrame : function($window) { - // Modified version of https://github.com/chrisdickinson/raf - // Copyright chrisdickinson I guess? - $window.requestAnimationFrame = typeof window === "object" ? window.requestAnimationFrame : function(fn) { - if(!_fns.length) { - var now = Date.now() - var next = Math.max(0, _frame - (now - _last)) - - _last = next + now - - setTimeout(function() { - var fns = _fns.slice() - - _fns = [] - - for(var i = 0; i < fns.length; i++) { - if(typeof fns[i] !== "function") { - continue - } - - fns[i](_last) - } - }, Math.round(next)) - } - - _fns.push(fn) - - return _fns.length - 1; - } - - $window.cancelAnimationFrame = typeof window === "object" ? window.cancelAnimationFrame : function(handle) { - _fns[handle] = null - }; - } -} - diff --git a/api/tests/test-mount.js b/api/tests/test-mount.js index e0e180a0..97358e76 100644 --- a/api/tests/test-mount.js +++ b/api/tests/test-mount.js @@ -16,7 +16,7 @@ o.spec("m.mount", function() { root = $window.document.body renderers = [] - mount = createMounter($window, renderers) + mount = apiMounter($window, renderers) }) o("pushes a render function", function() { @@ -31,7 +31,7 @@ o.spec("m.mount", function() { }) o("renders into `root`", function() { - var mount = createMounter($window, []) + var mount = apiMounter($window, []) mount(root, { view : function() { diff --git a/api/tests/test-router.js b/api/tests/test-router.js index caa7a09f..deb2fec1 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -23,7 +23,7 @@ o.spec("m.route", function() { root = $window.document.body renderers = [] - route = apiRouter($window, redraw) + route = apiRouter($window, renderers) }) o("pushes a render function", function() {