diff --git a/test/specs/controller.line.tests.js b/test/specs/controller.line.tests.js index 285f5c988a2..1b9cdb0c0c3 100644 --- a/test/specs/controller.line.tests.js +++ b/test/specs/controller.line.tests.js @@ -573,6 +573,61 @@ describe('Chart.controllers.line', function() { expect(meta.dataset._model.borderWidth).toBe(0.55); }); + it('should fall back to the dataset default spanGaps option', function() { + var chart = window.acquireChart({ + type: 'line', + data: { + datasets: [{ + data: [0, 0], + label: 'dataset1' + }], + labels: ['label1', 'label2'] + } + }); + + var meta = chart.getDatasetMeta(0); + + expect(meta.dataset._model.spanGaps).toBe(true); + }); + + it('should obey the global spanGaps option', function() { + var chart = window.acquireChart({ + type: 'line', + data: { + datasets: [{ + data: [0, 0], + label: 'dataset1' + }], + labels: ['label1', 'label2'] + }, + options: { + spanGaps: false + } + }); + + var meta = chart.getDatasetMeta(0); + + expect(meta.dataset._model.spanGaps).toBe(false); + }); + + it('should obey the dataset spanGaps option', function() { + var chart = window.acquireChart({ + type: 'line', + data: { + datasets: [{ + data: [0, 0], + label: 'dataset1', + spanGaps: false + }], + labels: ['label1', 'label2'] + } + }); + + var meta = chart.getDatasetMeta(0); + + expect(meta.dataset._model.spanGaps).toBe(false); + }); + it('should handle number of data point changes in update', function() { var chart = window.acquireChart({ type: 'line', diff --git a/test/specs/controller.scatter.test.js b/test/specs/controller.scatter.test.js index bc1ff18bf49..a2744b9e437 100644 --- a/test/specs/controller.scatter.test.js +++ b/test/specs/controller.scatter.test.js @@ -47,5 +47,28 @@ describe('Chart.controllers.scatter', function() { expect(meta.dataset.draw.calls.count()).toBe(0); expect(meta.data[0].draw.calls.count()).toBe(1); }); + + it('should draw a line if true', function() { + var chart = window.acquireChart({ + type: 'scatter', + data: { + datasets: [{ + data: [{x: 10, y: 15}], + showLine: true, + 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(1); + expect(meta.data[0].draw.calls.count()).toBe(1); + }); }); });