Skip to content

Commit b11d643

Browse files
committed
Updated controller.scatter.test.js to test default tooltip callbacks
- This moves the mouse over the drawn point and verifies that there is no title in the tooltip and that the body contains expected content.
1 parent b7139db commit b11d643

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/specs/controller.scatter.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ describe('Chart.controllers.scatter', function() {
33
expect(typeof Chart.controllers.scatter).toBe('function');
44
});
55

6+
it('should test default tooltip callbacks', function() {
7+
var chart = window.acquireChart({
8+
type: 'scatter',
9+
data: {
10+
datasets: [{
11+
data: [{
12+
x: 10,
13+
y: 15
14+
}],
15+
label: 'dataset1'
16+
}],
17+
},
18+
options: {}
19+
});
20+
var point = chart.getDatasetMeta(0).data[0];
21+
jasmine.triggerMouseEvent(chart, 'mousemove', point);
22+
23+
// Title should be empty
24+
expect(chart.tooltip._view.title.length).toBe(0);
25+
expect(chart.tooltip._view.body[0].lines).toEqual(['(10, 15)']);
26+
});
27+
628
describe('showLines option', function() {
729
it('should not draw a line if undefined', function() {
830
var chart = window.acquireChart({

0 commit comments

Comments
 (0)