]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add tests related to showLines for controller.scatter (#5150)
authorLoïc Bourgois <loic@bourgois.pro>
Tue, 16 Jan 2018 09:29:49 +0000 (09:29 +0000)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Tue, 16 Jan 2018 09:29:49 +0000 (10:29 +0100)
test/specs/controller.scatter.test.js [new file with mode: 0644]

diff --git a/test/specs/controller.scatter.test.js b/test/specs/controller.scatter.test.js
new file mode 100644 (file)
index 0000000..4357509
--- /dev/null
@@ -0,0 +1,25 @@
+describe('Chart.controllers.scatter', function() {
+       describe('showLines option', function() {
+               it('should not draw a line if undefined', function() {
+                       var chart = window.acquireChart({
+                               type: 'scatter',
+                               data: {
+                                       datasets: [{
+                                               data: [{x: 10, y: 15}],
+                                               label: 'dataset1'
+                                       }],
+                               },
+                               options: {}
+                       });
+
+                       var meta = chart.getDatasetMeta(0);
+                       spyOn(meta.dataset, 'draw');
+                       spyOn(meta.data[0], 'draw');
+
+                       chart.update();
+
+                       expect(meta.dataset.draw.calls.count()).toBe(0);
+                       expect(meta.data[0].draw.calls.count()).toBe(1);
+               });
+       });
+});