Skip to content

Commit 8c89c7a

Browse files
committed
Add additional tests
1 parent 31ffe80 commit 8c89c7a

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

test/specs/controller.line.tests.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,61 @@ describe('Chart.controllers.line', function() {
573573
expect(meta.dataset._model.borderWidth).toBe(0.55);
574574
});
575575

576+
it('should fall back to the dataset default spanGaps option', function() {
577+
var chart = window.acquireChart({
578+
type: 'line',
579+
data: {
580+
datasets: [{
581+
data: [0, 0],
582+
label: 'dataset1'
583+
}],
584+
labels: ['label1', 'label2']
585+
}
586+
});
587+
588+
var meta = chart.getDatasetMeta(0);
589+
590+
expect(meta.dataset._model.spanGaps).toBe(true);
591+
});
592+
593+
it('should obey the global spanGaps option', function() {
594+
var chart = window.acquireChart({
595+
type: 'line',
596+
data: {
597+
datasets: [{
598+
data: [0, 0],
599+
label: 'dataset1'
600+
}],
601+
labels: ['label1', 'label2']
602+
},
603+
options: {
604+
spanGaps: false
605+
}
606+
});
607+
608+
var meta = chart.getDatasetMeta(0);
609+
610+
expect(meta.dataset._model.spanGaps).toBe(false);
611+
});
612+
613+
it('should obey the dataset spanGaps option', function() {
614+
var chart = window.acquireChart({
615+
type: 'line',
616+
data: {
617+
datasets: [{
618+
data: [0, 0],
619+
label: 'dataset1',
620+
spanGaps: false
621+
}],
622+
labels: ['label1', 'label2']
623+
}
624+
});
625+
626+
var meta = chart.getDatasetMeta(0);
627+
628+
expect(meta.dataset._model.spanGaps).toBe(false);
629+
});
630+
576631
it('should handle number of data point changes in update', function() {
577632
var chart = window.acquireChart({
578633
type: 'line',

test/specs/controller.scatter.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,28 @@ describe('Chart.controllers.scatter', function() {
4747
expect(meta.dataset.draw.calls.count()).toBe(0);
4848
expect(meta.data[0].draw.calls.count()).toBe(1);
4949
});
50+
51+
it('should draw a line if true', function() {
52+
var chart = window.acquireChart({
53+
type: 'scatter',
54+
data: {
55+
datasets: [{
56+
data: [{x: 10, y: 15}],
57+
showLine: true,
58+
label: 'dataset1'
59+
}],
60+
},
61+
options: {}
62+
});
63+
64+
var meta = chart.getDatasetMeta(0);
65+
spyOn(meta.dataset, 'draw');
66+
spyOn(meta.data[0], 'draw');
67+
68+
chart.update();
69+
70+
expect(meta.dataset.draw.calls.count()).toBe(1);
71+
expect(meta.data[0].draw.calls.count()).toBe(1);
72+
});
5073
});
5174
});

0 commit comments

Comments
 (0)