diff options
author | Wilson Page <wilsonpage@me.com> | 2013-10-25 14:46:56 +0100 |
---|---|---|
committer | Wilson Page <wilsonpage@me.com> | 2013-10-25 14:46:56 +0100 |
commit | d3ec52b212ebb6f216daae5e5d7ab0ba3342f7bf (patch) | |
tree | e646560770e7883d968d6ee4488cbd332600c314 | |
parent | 65720667dc4a934da89bbbea816802dcbd9ffc87 (diff) | |
download | fastdom-d3ec52b212ebb6f216daae5e5d7ab0ba3342f7bf.zip fastdom-d3ec52b212ebb6f216daae5e5d7ab0ba3342f7bf.tar.gz fastdom-d3ec52b212ebb6f216daae5e5d7ab0ba3342f7bf.tar.bz2 |
Alter tests to catch errors in existing methods
-rw-r--r-- | test/test.defer.js | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/test/test.defer.js b/test/test.defer.js index 3a91c95..ef931c5 100644 --- a/test/test.defer.js +++ b/test/test.defer.js @@ -110,15 +110,12 @@ suite('defer', function(){ test('Should run the next frame even if frame before it errors', function(done) { var fastdom = new FastDom(); - var frame = fastdom.frame; + var run = fastdom.run; var error = sinon.stub().throws(); var callback = sinon.spy(); - - sinon.stub(fastdom, 'frame', function() { - try { - frame.call(fastdom); - } catch (e) {} + sinon.stub(fastdom, 'run', function() { + try { run.apply(fastdom, arguments); } catch (e) {} }); fastdom.defer(error); @@ -132,15 +129,15 @@ suite('defer', function(){ }); }); - test.only('Should continue to run future jobs when the last frame errors', function(done) { + test('Should continue to run future jobs when the last frame errors', function(done) { var fastdom = new FastDom(); - var frame = fastdom.frame; + var run = fastdom.run; var error = sinon.stub().throws(); var callback1 = sinon.spy(); var callback2 = sinon.spy(); - sinon.stub(fastdom, 'frame', function() { - try { frame.call(fastdom); } catch (e) {} + sinon.stub(fastdom, 'run', function() { + try { run.apply(fastdom, arguments); } catch (e) {} }); fastdom.defer(callback1); @@ -148,7 +145,7 @@ suite('defer', function(){ setTimeout(function() { fastdom.defer(callback2); - }, 100); + }, 40); raf(function() { assert(callback1.called, 'the first job was run'); @@ -158,7 +155,7 @@ suite('defer', function(){ assert(callback2.called, 'the third job was run'); done(); }); - }, 100); + }, 40); }); }); }); |