]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add a testcase for the new option name "lineTension"
authorJannis Achstetter <jannis.achstetter@schneider-electric.com>
Thu, 21 Apr 2016 07:12:03 +0000 (09:12 +0200)
committerJannis Achstetter <jannis.achstetter@schneider-electric.com>
Thu, 21 Apr 2016 07:41:27 +0000 (09:41 +0200)
test/controller.line.tests.js

index 624c38584a4db1f3da975519f6e83e31102ad78a..7a4f3c9f7209cb8519ac99438c927c41426f9bfb 100644 (file)
@@ -456,6 +456,61 @@ describe('Line controller tests', function() {
       controlPointNextY: 194,
     });
 
+    // Use the consistent name "lineTension", setting but overwriting
+    // another value in "tension"
+    chart.data.datasets[0].lineTension = 0.5;
+    chart.data.datasets[0].tension = 0.7;
+
+    controller.update();
+
+    expect(chart.data.datasets[0].metaDataset._model).toEqual({
+      backgroundColor: 'rgb(98, 98, 98)',
+      borderCapStyle: 'butt',
+      borderColor: 'rgb(8, 8, 8)',
+      borderDash: [2, 3],
+      borderDashOffset: 7,
+      borderJoinStyle: 'miter',
+      borderWidth: 0.55,
+      fill: false,
+      tension: 0.5,
+
+      scaleTop: 0,
+      scaleBottom: 200,
+      scaleZero: 156,
+    });
+
+    expect(chart.data.datasets[0].metaData[0]._model).toEqual({
+      x: 82,
+      y: 62,
+      radius: 22,
+      pointStyle: 'circle',
+      backgroundColor: 'rgb(128, 129, 130)',
+      borderColor: 'rgb(56, 57, 58)',
+      borderWidth: 1.123,
+      hitRadius: 3.3,
+      skip: false,
+      controlPointPreviousX: 82,
+      controlPointPreviousY: 62,
+      controlPointNextX: 107,
+      controlPointNextY: 38.5
+    });
+
+    expect(chart.data.datasets[0].metaData[1]._model).toEqual({
+      x: 132,
+      y: 15,
+      radius: 22,
+      pointStyle: 'circle',
+      backgroundColor: 'rgb(128, 129, 130)',
+      borderColor: 'rgb(56, 57, 58)',
+      borderWidth: 1.123,
+      hitRadius: 3.3,
+      skip: false,
+      controlPointPreviousX: 116.2771987579006,
+      controlPointPreviousY: 0.22056683242656483,
+      controlPointNextX: 166.2771987579006,
+      controlPointNextY: 47.22056683242656
+    });
+
     // Use custom styles for lines & first point
     chart.data.datasets[0].metaDataset.custom = {
       tension: 0.15,