X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fplugins.js;h=36051137223a2ac10d545674376469cf354a5381;hb=8db6393ec8cac592f323724e43a2a7122a84614f;hp=565558523653e0bf743014eea0b8404671a37af3;hpb=c04c8044c2f04d8db1d7987cc5cb181c03f9d7df;p=dygraphs.git diff --git a/auto_tests/tests/plugins.js b/auto_tests/tests/plugins.js index 5655585..3605113 100644 --- a/auto_tests/tests/plugins.js +++ b/auto_tests/tests/plugins.js @@ -212,3 +212,24 @@ pluginsTestCase.prototype.testEventSequence = function() { "didDrawChart" ], events); }; + +pluginsTestCase.prototype.testDestroyCalledInOrder = function() { + var destructions = []; + var makePlugin = function(name) { + return { + activate: function(g) { return {} }, + destroy: function() { + destructions.push(name); + } + }; + }; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, this.data, { + plugins: [makePlugin('p'), makePlugin('q')] + }); + + assertEquals([], destructions); + g.destroy(); + assertEquals(['q', 'p'], destructions); +};