X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fmissing_points.js;h=dce01eda9aea094e07182ac60cf37929cabd5623;hb=f6e73ea983b61b50a6152c98a9945725eb45edb2;hp=cc1ae007264cad519022056d21b9220345374c88;hpb=89fdcedbda6906d90e15d84285c4f6c0b8d96d28;p=dygraphs.git diff --git a/auto_tests/tests/missing_points.js b/auto_tests/tests/missing_points.js index cc1ae00..dce01ed 100644 --- a/auto_tests/tests/missing_points.js +++ b/auto_tests/tests/missing_points.js @@ -23,21 +23,19 @@ * * @author konigsberg@google.com (Robert Konigsberg) */ + +import Dygraph from '../../src/dygraph'; +import * as utils from '../../src/dygraph-utils'; +import Proxy from './Proxy'; +import CanvasAssertions from './CanvasAssertions'; +import Util from './Util'; + var ZERO_TO_FIFTY = [[ 10, 0 ] , [ 20, 50 ]]; describe("missing-points", function() { -var _origFunc = Dygraph.getContext; -beforeEach(function() { - document.body.innerHTML = "
"; - Dygraph.getContext = function(canvas) { - return new Proxy(_origFunc(canvas)); - } -}); - -afterEach(function() { - Dygraph.getContext = _origFunc; -}); +cleanupAfterEach(); +useProxyCanvas(utils, Proxy); it('testSeparatedPointsDontDraw', function() { var graph = document.getElementById("graph"); @@ -46,7 +44,10 @@ it('testSeparatedPointsDontDraw', function() { [[1, 10, 11], [2, 11, null], [3, 12, 13]], - { colors: ['red', 'blue']}); + { + colors: ['red', 'blue'], + labels: ['X', 'Y1', 'Y2'] + }); var htx = g.hidden_ctx_; assert.equal(2, CanvasAssertions.numLinesDrawn(htx, '#ff0000')); assert.equal(0, CanvasAssertions.numLinesDrawn(htx, '#0000ff')); @@ -61,7 +62,7 @@ it('testSeparatedPointsDontDraw_expanded', function() { [2, null], [3, 13], [4, 14]], - { colors: ['blue']}); + { colors: ['blue'], labels: ['X', 'Y']}); var htx = g.hidden_ctx_; assert.equal(2, CanvasAssertions.numLinesDrawn(htx, '#0000ff')); @@ -80,7 +81,11 @@ it('testSeparatedPointsDontDraw_expanded_connected', function() { [2, null], [3, 13], [4, 14]], - { colors: ['blue'], connectSeparatedPoints: true}); + { + colors: ['blue'], + connectSeparatedPoints: true, + labels: ['X', 'Y'] + }); var htx = g.hidden_ctx_; var num_lines = 0; @@ -107,7 +112,8 @@ it('testConnectSeparatedPoints', function() { { connectSeparatedPoints: true, drawPoints: true, - colors: ['red', 'blue'] + colors: ['red', 'blue'], + labels: ['X', 'Y1', 'Y2'] } ); @@ -182,7 +188,8 @@ it('testErrorBarsWithMissingPoints', function() { data, { errorBars: true, - colors: ['red'] + colors: ['red'], + labels: ['X', 'Y'] } ); @@ -216,7 +223,8 @@ it('testErrorBarsWithMissingPointsConnected', function() { connectSeparatedPoints: true, drawPoints: true, errorBars: true, - colors: ['red'] + colors: ['red'], + labels: ['X', 'Y'] } ); @@ -251,7 +259,8 @@ it('testCustomBarsWithMissingPoints', function() { data, { customBars: true, - colors: ['red'] + colors: ['red'], + labels: ['X', 'Y'] } ); @@ -292,7 +301,8 @@ it('testCustomBarsWithMissingPointsConnected', function() { connectSeparatedPoints: true, drawPoints: true, customBars: true, - colors: ['red'] + colors: ['red'], + labels: ['X', 'Y'] } ); @@ -323,7 +333,8 @@ it('testLeftBoundaryWithMisingPoints', function() { { connectSeparatedPoints: true, drawPoints: true, - colors: ['red','blue'] + colors: ['red','blue'], + labels: ['X', 'Y1', 'Y2'] } ); g.updateOptions({ dateWindow : [ 2.5, 4.5 ] });