X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Ffill_step_plot.js;h=1c4314555b54884babcaea28d8d630ea919b60d2;hb=ce31caf22475e3e1fd6d9fea192d61ff4fcd7fac;hp=f40f8a5dd00895b508122154739d583a22467ce7;hpb=b4c7f0ad4b0e91eb39b84fc10066dc7e1a6ed4f6;p=dygraphs.git diff --git a/auto_tests/tests/fill_step_plot.js b/auto_tests/tests/fill_step_plot.js index f40f8a5..1c43145 100644 --- a/auto_tests/tests/fill_step_plot.js +++ b/auto_tests/tests/fill_step_plot.js @@ -4,27 +4,29 @@ * * @author benoitboivin.pro@gmail.com (Benoit Boivin) */ -var fillStepPlotTestCase = TestCase("fill-step-plot"); +import Dygraph from '../../src/dygraph'; +import * as utils from '../../src/dygraph-utils'; +import CanvasAssertions from './CanvasAssertions'; +import Proxy from './Proxy'; -fillStepPlotTestCase.prototype.setUp = function() { - document.body.innerHTML = "
"; -}; +describe("fill-step-plot", function() { -fillStepPlotTestCase.origFunc = Dygraph.getContext; +cleanupAfterEach(); -fillStepPlotTestCase.prototype.setUp = function() { - document.body.innerHTML = "
"; - Dygraph.getContext = function(canvas) { - return new Proxy(fillStepPlotTestCase.origFunc(canvas)); +var origFunc = utils.getContext; + +beforeEach(function() { + utils.getContext = function(canvas) { + return new Proxy(origFunc(canvas)); }; -}; +}); -fillStepPlotTestCase.prototype.tearDown = function() { - Dygraph.getContext = fillStepPlotTestCase.origFunc; -}; +afterEach(function() { + utils.getContext = origFunc; +}); -fillStepPlotTestCase.prototype.testFillStepPlotNullValues = function() { +it('testFillStepPlotNullValues', function() { var opts = { labels: ["x","y"], width: 480, @@ -45,7 +47,7 @@ fillStepPlotTestCase.prototype.testFillStepPlotNullValues = function() { var graph = document.getElementById("graph"); var g = new Dygraph(graph, data, opts); - htx = g.hidden_ctx_; + var htx = g.hidden_ctx_; var x1 = data[3][0]; var y1 = data[2][1]; var x2 = data[3][0]; @@ -55,4 +57,6 @@ fillStepPlotTestCase.prototype.testFillStepPlotNullValues = function() { // Check if a line is drawn between the previous y and the bottom of the chart CanvasAssertions.assertLineDrawn(htx, xy1, xy2, {}); -}; \ No newline at end of file +}); + +});