X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fhighlight_series_background.js;fp=auto_tests%2Ftests%2Fhighlight_series_background.js;h=60f4f8d1722452520def2e7875a340101466f3fb;hb=6833c463ec383edd9dd4051b7a4cb8de834e27d0;hp=aedc8edaf86ee2fcdd905dcda5008be44039a490;hpb=1715eee9eec72048d8fd94ce19127c330be3033e;p=dygraphs.git diff --git a/auto_tests/tests/highlight_series_background.js b/auto_tests/tests/highlight_series_background.js index aedc8ed..60f4f8d 100644 --- a/auto_tests/tests/highlight_series_background.js +++ b/auto_tests/tests/highlight_series_background.js @@ -1,18 +1,19 @@ /** - * @fileoverview Tests for the highlightSeriesBackgroundAlpha and highlightSeriesBackgroundColor options. + * @fileoverview Tests for the highlightSeriesBackgroundAlpha and + * highlightSeriesBackgroundColor options. * @author sergeyslepian@gmail.com */ -describe("highlight-series-background", function() { +import Dygraph from '../../src/dygraph'; +import * as utils from '../../src/dygraph-utils'; +import Util from './Util'; - beforeEach(function () { - document.body.innerHTML = "
"; - }); +describe("highlight-series-background", function() { - afterEach(function () { - }); + cleanupAfterEach(); - function setupGraph(highlightSeriesBackgroundAlpha, highlightSeriesBackgroundColor) { + function setupGraph(highlightSeriesBackgroundAlpha, + highlightSeriesBackgroundColor) { var opts = { width: 480, height: 320, @@ -25,16 +26,15 @@ describe("highlight-series-background", function() { } }; - if(highlightSeriesBackgroundAlpha !== undefined) opts.highlightSeriesBackgroundAlpha = highlightSeriesBackgroundAlpha; - if(highlightSeriesBackgroundColor !== undefined) opts.highlightSeriesBackgroundColor = highlightSeriesBackgroundColor; + if (highlightSeriesBackgroundAlpha) utils.update(opts, {highlightSeriesBackgroundAlpha}); + if (highlightSeriesBackgroundColor) utils.update(opts, {highlightSeriesBackgroundColor}); var data = []; for (var j = 0; j < 10; j++) { data.push([j, 0]); } - var graph = document.getElementById("graph"); - return new Dygraph(graph, data, opts); + return new Dygraph('graph', data, opts); } it('testDefaultHighlight', function(done) { @@ -66,7 +66,7 @@ describe("highlight-series-background", function() { }); it('testCustomHighlightColor', function(done) { - var graph = setupGraph(undefined, 'rgb(0,255,255)'); + var graph = setupGraph(null, 'rgb(0,255,255)'); assert.deepEqual(Util.samplePixel(graph.canvas_, 100, 100), [0,0,0,0]); @@ -106,4 +106,4 @@ describe("highlight-series-background", function() { done(); }, 1000); }); -}); \ No newline at end of file +});