146e4269264f32d4abc8c53714aebc6decb5335c
2 * @fileoverview Tests for the smooth (bezier curve) plotter.
4 * @author danvdk@gmail.com (Dan Vanderkam)
7 import Dygraph from
'../../src/dygraph';
8 import '../../src/extras/smooth-plotter'; // defines Dygraph.smoothPlotter
10 describe("smooth-plotter", function() {
12 var smoothPlotter
= Dygraph
.smoothPlotter
;
13 var getControlPoints
= smoothPlotter
._getControlPoints
;
15 beforeEach(function() {
18 afterEach(function() {
21 it('testNoSmoothing', function() {
22 var lastPt
= {x
: 10, y
: 0},
24 nextPt
= {x
: 12, y
: 0},
27 assert
.deepEqual([11, 1, 11, 1], getControlPoints(lastPt
, pt
, nextPt
, alpha
));
30 it('testHalfSmoothing', function() {
31 var lastPt
= {x
: 10, y
: 0},
33 nextPt
= {x
: 12, y
: 0},
36 assert
.deepEqual([10.5, 1, 11.5, 1], getControlPoints(lastPt
, pt
, nextPt
, alpha
));
39 it('testExtrema', function() {
40 var lastPt
= {x
: 10, y
: 0},
42 nextPt
= {x
: 12, y
: 1},
45 assert
.deepEqual([10.5, 0.75, 11.5, 1.25],
46 getControlPoints(lastPt
, pt
, nextPt
, alpha
, true));
48 assert
.deepEqual([10.5, 1, 11.5, 1],
49 getControlPoints(lastPt
, pt
, nextPt
, alpha
, false));