X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Finteraction_model.js;h=a363f55e65897d466f650142fb7aadb84be58071;hb=5cb6204347bf9e4ad2a1d243a40caea2bf8c54e7;hp=9147f1ba5bcb355c7b5e12a6d3c48c84a55cc192;hpb=1b89e01f33c071af04e0586163fa3c09ac115b09;p=dygraphs.git diff --git a/auto_tests/tests/interaction_model.js b/auto_tests/tests/interaction_model.js index 9147f1b..a363f55 100644 --- a/auto_tests/tests/interaction_model.js +++ b/auto_tests/tests/interaction_model.js @@ -136,6 +136,34 @@ InteractionModelTestCase.clickAt = function(g, x, y) { } /** + * This tests that clickCallback is still called with the nonInteractiveModel. + */ +InteractionModelTestCase.prototype.testClickCallbackIsCalledWithNonInteractiveModel = function() { + var clicked; + + // TODO(danvk): also test pointClickCallback here. + var clickCallback = function(event, x) { + clicked = x; + }; + + var opts = { + width: 100, + height : 100, + clickCallback : clickCallback, + interactionModel : Dygraph.Interaction.nonInteractiveModel_ + }; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data1, opts); + + DygraphOps.dispatchMouseDown_Point(g, 10, 10); + DygraphOps.dispatchMouseMove_Point(g, 10, 10); + DygraphOps.dispatchMouseUp_Point(g, 10, 10); + + assertEquals(20, clicked); +}; + +/** * A sanity test to ensure pointClickCallback is called. */ InteractionModelTestCase.prototype.testPointClickCallback = function() {