X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsimple_drawing.js;h=2ef84f3d9425b77782de3f54d83150c87dbc213d;hb=91e3b7f8b508d2ec2a03c2a2a0dc6bd32ad5ac6d;hp=557013274acf9bbf916dfda22ac8a68d311d611c;hpb=3123ca57f71d145bb5bcc4a2f754d3dff3225346;p=dygraphs.git diff --git a/auto_tests/tests/simple_drawing.js b/auto_tests/tests/simple_drawing.js index 5570132..2ef84f3 100644 --- a/auto_tests/tests/simple_drawing.js +++ b/auto_tests/tests/simple_drawing.js @@ -23,35 +23,35 @@ * * @author konigsberg@google.com (Robert Konigsberg) */ -var ZERO_TO_FIFTY = [[ 10, 0 ] , [ 20, 50 ]]; + +import Dygraph from '../../src/dygraph'; +import * as utils from '../../src/dygraph-utils'; + +import CanvasAssertions from './CanvasAssertions'; +import Proxy from './Proxy'; +import PixelSampler from './PixelSampler'; describe("simple-drawing", function() { -var _origFunc = Dygraph.getContext; -beforeEach(function() { - document.body.innerHTML = "
"; - Dygraph.getContext = function(canvas) { - return new Proxy(_origFunc(canvas)); - } -}); +cleanupAfterEach(); +useProxyCanvas(utils, Proxy); -afterEach(function() { - Dygraph.getContext = _origFunc; -}); +var ZERO_TO_FIFTY = 'X,Y\n10,0\n20,50'; it('testDrawSimpleRangePlusOne', function() { var opts = { - axes : { - x : { + axes: { + x: { drawGrid: false, - drawAxis: false, + drawAxis: false }, - y : { + y: { drawGrid: false, - drawAxis: false, + drawAxis: false } }, - valueRange: [0,51] } + valueRange: [0,51] + }; var graph = document.getElementById("graph"); var g = new Dygraph(graph, ZERO_TO_FIFTY, opts); @@ -121,7 +121,8 @@ it('testDrawSimpleDash', function() { series: { 'Y1': {strokePattern: [25, 7, 7, 7]}, }, - colors: ['#ff0000'] + colors: ['#ff0000'], + labels: ['X', 'Y'] }; var graph = document.getElementById("graph"); @@ -143,18 +144,19 @@ it('testDrawSimpleDash', function() { */ it('testDrawThickLine', function() { var opts = { - axes : { - x : { + axes: { + x: { drawGrid: false, - drawAxis: false, + drawAxis: false }, - y : { + y: { drawGrid: false, - drawAxis: false, + drawAxis: false } }, strokeWidth: 15, - colors: ['#ff0000'] + colors: ['#ff0000'], + labels: ['X', 'Y'] }; var graph = document.getElementById("graph");