Add unit test to detect the "unwanted draw point"
authorMarcus Lewis <mrcslws@gmail.com>
Thu, 5 May 2016 19:55:17 +0000 (12:55 -0700)
committerMarcus Lewis <mrcslws@gmail.com>
Thu, 5 May 2016 19:55:17 +0000 (12:55 -0700)
auto_tests/tests/draw_gap_edge_points.js [new file with mode: 0644]

diff --git a/auto_tests/tests/draw_gap_edge_points.js b/auto_tests/tests/draw_gap_edge_points.js
new file mode 100644 (file)
index 0000000..3d92b0f
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * @fileoverview Test cases for the option "drawGapEdgePoints"
+ */
+
+import Dygraph from '../../src/dygraph';
+import * as utils from '../../src/dygraph-utils';
+
+describe("draw-gap-edge-points", function() {
+
+  cleanupAfterEach();
+
+  it("shouldn't draw any points by default", function() {
+    var called = false;
+    var g = new Dygraph(document.getElementById("graph"),
+                        [[0, 0],
+                         [1, 1],
+                         [2, 2],
+                         [3, 3],
+                         [4, 4],
+                         [5, 5]],
+                        {labels: ['a', 'b'],
+                         drawGapEdgePoints: true,
+                         drawPointCallback: function() { called = true; }});
+
+    assert.isFalse(called);
+  });
+
+  it("shouldn't draw any points by default (no axes)", function() {
+    var called = false;
+    var g = new Dygraph(document.getElementById("graph"),
+                        [[0, 0],
+                         [1, 1],
+                         [2, 2],
+                         [3, 3],
+                         [4, 4],
+                         [5, 5]],
+                        {labels: ['a', 'b'],
+                         drawGapEdgePoints: true,
+                         drawPointCallback: function() { called = true; },
+                         axes: {
+                           x: { drawAxis: false },
+                           y: { drawAxis: false }
+                         }});
+
+    assert.isFalse(called);
+  });
+});