X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fupdate_while_panning.js;fp=auto_tests%2Ftests%2Fupdate_while_panning.js;h=a94f6bdf9c57b15f8f0e48fdb1ede237907488ff;hb=3123ca57f71d145bb5bcc4a2f754d3dff3225346;hp=8634bd0b995feac40c0acfffbd398acc20160290;hpb=26ee953643ccd2d32e38e6b60b20e6a01c1dc9ba;p=dygraphs.git diff --git a/auto_tests/tests/update_while_panning.js b/auto_tests/tests/update_while_panning.js index 8634bd0..a94f6bd 100644 --- a/auto_tests/tests/update_while_panning.js +++ b/auto_tests/tests/update_while_panning.js @@ -5,20 +5,20 @@ * * @author dan@dygraphs.com (Dan Vanderkam) */ -var updateWhilePanningTestCase = TestCase("update-while-panning"); +describe("update-while-panning", function() { -updateWhilePanningTestCase.prototype.setUp = function() { +beforeEach(function() { document.body.innerHTML = "
"; -}; +}); -updateWhilePanningTestCase.prototype.tearDown = function() { -}; +afterEach(function() { +}); // This tests the following sequence: // 1. Begin dragging a chart (x-panning) // 2. Do a data update (updateOptions({file: ...})) // 3. Verify that the y-axis is still well-defined. -updateWhilePanningTestCase.prototype.testUpdateWhilePanning = function() { +it('testUpdateWhilePanning', function() { var sinewave = function(start, limit, step) { var data = []; for (var x = start; x < limit; x += step) { @@ -36,23 +36,25 @@ updateWhilePanningTestCase.prototype.testUpdateWhilePanning = function() { var graph = document.getElementById("graph"); var g = new Dygraph(graph, sinewave(0, 6, 0.1), opts); - assertEquals([-2, 2], g.yAxisRange()); + assert.deepEqual([-2, 2], g.yAxisRange()); // Start a pan, but don't finish it yet. DygraphOps.dispatchMouseDown_Point(g, 200, 100, {shiftKey: true}); DygraphOps.dispatchMouseMove_Point(g, 100, 100, {shiftKey: true}); - assertEquals([-2, 2], g.yAxisRange()); + assert.deepEqual([-2, 2], g.yAxisRange()); // Now do a data update. y-axis should remain the same. g.updateOptions({file: sinewave(0, 7, 0.1)}); - assertEquals([-2, 2], g.yAxisRange()); + assert.deepEqual([-2, 2], g.yAxisRange()); // Keep the pan going. DygraphOps.dispatchMouseMove_Point(g, 50, 100, {shiftKey: true}); - assertEquals([-2, 2], g.yAxisRange()); + assert.deepEqual([-2, 2], g.yAxisRange()); // Now finish the pan. DygraphOps.dispatchMouseUp_Point(g, 100, 100, {shiftKey: true}); - assertEquals([-2, 2], g.yAxisRange()); -}; + assert.deepEqual([-2, 2], g.yAxisRange()); +}); + +});