summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTomer Lahav <Melatonin64@users.noreply.github.com>2017-05-02 03:54:05 -0400
committerWilson Page <wilsonpage@me.com>2017-05-02 08:54:05 +0100
commit6424d555db9af29295a5a21178eb8cfa2d83eec4 (patch)
treea04350d3546c5b1979ce0ffe4dc2869716242fe3 /test
parent970bae9afb9cbde0b6484e57794c94467b44f549 (diff)
downloadfastdom-6424d555db9af29295a5a21178eb8cfa2d83eec4.zip
fastdom-6424d555db9af29295a5a21178eb8cfa2d83eec4.tar.gz
fastdom-6424d555db9af29295a5a21178eb8cfa2d83eec4.tar.bz2
Fix fastdom-strict callbacks not being called with context (fixes #108) (#109)
Diffstat (limited to 'test')
-rw-r--r--test/fastdom-strict-test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/fastdom-strict-test.js b/test/fastdom-strict-test.js
index 688e8b2..d7c5779 100644
--- a/test/fastdom-strict-test.js
+++ b/test/fastdom-strict-test.js
@@ -2,6 +2,7 @@
/*jshint maxlen:false*/
suite('fastdom-strict', function() {
+ var raf = window.requestAnimationFrame;
var fastdom;
var el;
@@ -75,4 +76,21 @@ suite('fastdom-strict', function() {
el.clientWidth;
}).then(done);
});
+
+ test('callback is called with correct context when measuring and mutating', function(done) {
+ var ctx1 = { foo: 'bar' };
+ var ctx2 = { bar: 'baz' };
+
+ var spy1 = sinon.spy();
+ var spy2 = sinon.spy();
+
+ fastdom.measure(spy1, ctx1);
+ fastdom.mutate(spy2, ctx2);
+
+ raf(function() {
+ assert(spy1.calledOn(ctx1));
+ assert(spy2.calledOn(ctx2));
+ done();
+ });
+ });
});