Set this for drawCallback
[dygraphs.git] / auto_tests / tests / callback.js
index d41d91e..b12ea64 100644 (file)
@@ -686,7 +686,7 @@ it('testDrawPointCallback_idx', function() {
 
 /**
  * Test that the correct idx is returned for the point in the onHiglightCallback.
 */
+ */
 it('testDrawHighlightPointCallback_idx', function() {
   var idxToCheck = null;
 
@@ -712,4 +712,16 @@ it('testDrawHighlightPointCallback_idx', function() {
   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);
+    }
+  });
+});
+
 });