From: Joseph Rossi Date: Mon, 16 Nov 2015 19:55:44 +0000 (-0500) Subject: Tests for 0 coordinate in selection drawing and lengend generation. X-Git-Tag: v2.0.0~31^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=da6089e88bd10a434f56755eb99fe4a5aa1cc867;p=dygraphs.git Tests for 0 coordinate in selection drawing and lengend generation. This test demonstrates how updateSelection_ and generateLegendHTML were ignoring points whose canvas-y value was 0. The next commit will fix these breaking tests --- diff --git a/auto_tests/tests/highlight_series_background.js b/auto_tests/tests/highlight_series_background.js old mode 100644 new mode 100755 index d2a09f0..abf0d6a --- a/auto_tests/tests/highlight_series_background.js +++ b/auto_tests/tests/highlight_series_background.js @@ -122,4 +122,29 @@ describe("highlight-series-background", function() { done(); }, 500); }); + + it('testGetSelectionZeroCanvasY', function () { + var graph = document.getElementById("graph"); + var calls = [] + function callback(g, seriesName, canvasContext, cx, cy, color, pointSize, idx) { + calls.push(arguments); + }; + + var g = new Dygraph(document.getElementById("graph"), + "X,Y\n" + + "1,5\n" + + "1,10\n" + + "1,12\n", + { + drawHighlightPointCallback: callback, + axes: { + y: { + valueRange: [0, 10] + } + } + }); + g.setSelection(1); + var args = calls[0]; + assert.equal(args[4], 0); + }); }); diff --git a/auto_tests/tests/plugins_legend.js b/auto_tests/tests/plugins_legend.js old mode 100644 new mode 100755 index e0384c8..5f67591 --- a/auto_tests/tests/plugins_legend.js +++ b/auto_tests/tests/plugins_legend.js @@ -113,4 +113,30 @@ it('should use a legendFormatter', function() { assert.equal(calls[2].series[0].y, undefined); }); +it('should include point drawn where canvas-y is 0', function () { + var graph = document.getElementById("graph"); + var calls = [] + function callback(data) { + calls.push(data); + }; + + var g = new Dygraph(document.getElementById("graph"), + "X,Y\n" + + "1,5\n" + + "1,10\n" + + "1,12\n", + { + legendFormatter: callback, + axes: { + y: { + valueRange: [0, 10] + } + } + }); + g.setSelection(1); + var data = calls[1]; + assert.isTrue(data.series[0].isVisible); + assert.notEqual(data.series[0].yHTML, ''); +}); + });