Skip to content

Commit

Permalink
Fix bug in RecordingContext
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Sep 24, 2015
1 parent 0a606a6 commit c728de0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/data-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function RecordingContext(ctx: CanvasRenderingContext2D) {
// TODO: record current drawing style
var args = Array.prototype.slice.call(arguments);
calls.push([k].concat(args));
ctx[k].apply(ctx, arguments);
return ctx[k].apply(ctx, arguments);
};
})(k);
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/data-canvas-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,13 @@ describe('data-canvas', function() {

// TODO: check drawing styles
});

it('should return values from proxied functions', function() {
var dtx = new dataCanvas.RecordingContext(ctx);
var metrics = dtx.measureText('Hello');

expect(dtx.calls).to.deep.equal([['measureText', 'Hello']]);
expect(metrics.width).to.be.greaterThan(0);
});
});
});

0 comments on commit c728de0

Please sign in to comment.