Skip to content

Commit

Permalink
Test default tooltip callbacks for scatter charts (#5967)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
darless authored and simonbrunel committed Jan 9, 2019
1 parent f342299 commit 9ecae7c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/specs/controller.scatter.test.js
Expand Up @@ -3,6 +3,28 @@ describe('Chart.controllers.scatter', function() {
expect(typeof Chart.controllers.scatter).toBe('function');
});

it('should test default tooltip callbacks', function() {
var chart = window.acquireChart({
type: 'scatter',
data: {
datasets: [{
data: [{
x: 10,
y: 15
}],
label: 'dataset1'
}],
},
options: {}
});
var point = chart.getDatasetMeta(0).data[0];
jasmine.triggerMouseEvent(chart, 'mousemove', point);

// Title should be empty
expect(chart.tooltip._view.title.length).toBe(0);
expect(chart.tooltip._view.body[0].lines).toEqual(['(10, 15)']);
});

describe('showLines option', function() {
it('should not draw a line if undefined', function() {
var chart = window.acquireChart({
Expand Down

0 comments on commit 9ecae7c

Please sign in to comment.