]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix typo, add tests to catch (#8768)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Thu, 1 Apr 2021 15:11:14 +0000 (18:11 +0300)
committerGitHub <noreply@github.com>
Thu, 1 Apr 2021 15:11:14 +0000 (11:11 -0400)
* Fix typo, add tests to catch
* Tune tests

src/elements/element.arc.js
test/fixtures/controller.doughnut/single-slice-circumference-405.js [new file with mode: 0644]
test/fixtures/controller.doughnut/single-slice-circumference-405.png [new file with mode: 0644]
test/fixtures/controller.doughnut/single-slice-opacity.js [new file with mode: 0644]
test/fixtures/controller.doughnut/single-slice-opacity.png [new file with mode: 0644]

index 37d6625259ecf98be392f49861c66802feac6749..376b8ebe9c188d7ceedd1c41ce4b8424c993e1db 100644 (file)
@@ -41,7 +41,7 @@ function drawArc(ctx, element) {
       ctx.fill();
     }
   }
-  if (!isNaN(element.curcumference)) {
+  if (!isNaN(element.circumference)) {
     element.endAngle = element.startAngle + element.circumference % TAU;
   }
 
diff --git a/test/fixtures/controller.doughnut/single-slice-circumference-405.js b/test/fixtures/controller.doughnut/single-slice-circumference-405.js
new file mode 100644 (file)
index 0000000..639d757
--- /dev/null
@@ -0,0 +1,21 @@
+module.exports = {
+  threshold: 0.05,
+  config: {
+    type: 'doughnut',
+    data: {
+      labels: ['A'],
+      datasets: [{
+        data: [1],
+        backgroundColor: 'rgba(0,0,0,0.3)',
+        borderColor: 'rgba(0,0,0,0.5)',
+        circumference: 405
+      }]
+    },
+  },
+  options: {
+    canvas: {
+      width: 256,
+      height: 256
+    }
+  }
+};
diff --git a/test/fixtures/controller.doughnut/single-slice-circumference-405.png b/test/fixtures/controller.doughnut/single-slice-circumference-405.png
new file mode 100644 (file)
index 0000000..0591cca
Binary files /dev/null and b/test/fixtures/controller.doughnut/single-slice-circumference-405.png differ
diff --git a/test/fixtures/controller.doughnut/single-slice-opacity.js b/test/fixtures/controller.doughnut/single-slice-opacity.js
new file mode 100644 (file)
index 0000000..8dd6dab
--- /dev/null
@@ -0,0 +1,20 @@
+module.exports = {
+  threshold: 0.05,
+  config: {
+    type: 'doughnut',
+    data: {
+      labels: ['A'],
+      datasets: [{
+        data: [1],
+        backgroundColor: 'rgba(0,0,0,0.3)',
+        borderColor: 'rgba(0,0,0,0.5)'
+      }]
+    },
+  },
+  options: {
+    canvas: {
+      width: 256,
+      height: 256
+    }
+  }
+};
diff --git a/test/fixtures/controller.doughnut/single-slice-opacity.png b/test/fixtures/controller.doughnut/single-slice-opacity.png
new file mode 100644 (file)
index 0000000..9a55d1c
Binary files /dev/null and b/test/fixtures/controller.doughnut/single-slice-opacity.png differ