/**
* Test that the correct idx is returned for the point in the onHiglightCallback.
- */
+ */
it('testDrawHighlightPointCallback_idx', function() {
var idxToCheck = null;
assert.equal(5,idxToCheck);
});
+/**
+ * Test that drawCallback is called with the correct value for `this`.
+ */
+it('should set this in drawCallback', function() {
+ var g = new Dygraph('graph', data, {
+ drawCallback: function(g, is_initial) {
+ assert.isTrue(is_initial);
+ assert.equal(g, this);
+ }
+ });
+});
+
});
this.canvas_.getContext('2d').clearRect(0, 0, this.width_, this.height_);
if (this.getFunctionOption("drawCallback") !== null) {
- this.getFunctionOption("drawCallback")(this, is_initial_draw);
+ this.getFunctionOption("drawCallback").call(this, this, is_initial_draw);
}
if (is_initial_draw) {
this.readyFired_ = true;