From: Nodar Nutsubidze <3382617+MadRussian@users.noreply.github.com> Date: Wed, 9 Jan 2019 13:37:25 +0000 (-0600) Subject: Test default tooltip callbacks for scatter charts (#5967) X-Git-Tag: v2.8.0-rc.1~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ecae7c5fb9e33f50f5c6d95055643e2ce87d372;p=thirdparty%2FChart.js.git Test default tooltip callbacks for scatter charts (#5967) 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. --- diff --git a/test/specs/controller.scatter.test.js b/test/specs/controller.scatter.test.js index 6063caed7..bc1ff18bf 100644 --- a/test/specs/controller.scatter.test.js +++ b/test/specs/controller.scatter.test.js @@ -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({