Skip to content

Commit

Permalink
Merge 80d8c2e into 8d9e20f
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonpage committed May 4, 2016
2 parents 8d9e20f + 80d8c2e commit d5e1859
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sudo: required
dist: trusty

language: node_js

node_js:
Expand Down
2 changes: 1 addition & 1 deletion extensions/fastdom-promised.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function create(promised, type, fn, ctx) {
var promise = new Promise(function(resolve, reject) {
task = fastdom[type](function() {
tasks.delete(promise);
try { resolve(fn()); }
try { resolve(ctx ? fn.call(ctx) : fn()); }
catch (e) { reject(e); }
}, ctx);
});
Expand Down
10 changes: 10 additions & 0 deletions test/fastdom-promised-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@ suite('fastdom-promised', function() {
done();
});
});

test('it calls callback with given context', function() {
var spy = sinon.spy();
var ctx = {};

return fastdom.measure(spy, ctx)
.then(function() {
sinon.assert.calledOn(spy, ctx);
});
});
});

0 comments on commit d5e1859

Please sign in to comment.