From 9ecae7c5fb9e33f50f5c6d95055643e2ce87d372 Mon Sep 17 00:00:00 2001 From: Nodar Nutsubidze <3382617+MadRussian@users.noreply.github.com> Date: Wed, 9 Jan 2019 07:37:25 -0600 Subject: [PATCH] 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. --- test/specs/controller.scatter.test.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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({ -- 2.47.3