X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fcallback.js;h=0e6b4fa78b63d2e9d54af3fb74b0008d3d86b60e;hb=1a19005fada6b8f190aa35b3908dc571ea360d3e;hp=6d3df1de66d6f175c17b862919311b1afe6ffa57;hpb=cbfcf21db4a2ef0f5db409591146f975ffe7b7f2;p=dygraphs.git diff --git a/auto_tests/tests/callback.js b/auto_tests/tests/callback.js index 6d3df1d..0e6b4fa 100644 --- a/auto_tests/tests/callback.js +++ b/auto_tests/tests/callback.js @@ -302,6 +302,27 @@ CallbackTestCase.prototype.testClosestPointCallbackCss2 = function() { } /** + * Closest-point highlighting with locked series. + */ +CallbackTestCase.prototype.testSetSelectionLocking = function() { + var g = runClosestTest(false, 2, 4); + + // Default behavior, 'b' is closest + DygraphOps.dispatchMouseMove(g, 11, 4); + assertEquals('b', g.getHighlightSeries()); + + // Now lock selection to 'c' + g.setSelection(false, 'c', true); + DygraphOps.dispatchMouseMove(g, 11, 4); + assertEquals('c', g.getHighlightSeries()); + + // Unlock, should be back to 'b' + g.clearSelection(); + DygraphOps.dispatchMouseMove(g, 11, 4); + assertEquals('b', g.getHighlightSeries()); +} + +/** * This tests that closest point searches work for data containing NaNs. * * It's intended to catch a regression where a NaN Y value confuses the