@@ -32,14 +32,12 @@ function makePlot(gd, layoutExtras = {}, configExtras) {
3232 );
3333}
3434
35- describe('hoveranywhere', function () {
35+ describe('hoveranywhere', () => {
3636 'use strict';
3737
3838 var gd;
3939
40- beforeEach(function () {
41- gd = createGraphDiv();
42- });
40+ beforeEach(() => (gd = createGraphDiv()));
4341 afterEach(destroyGraphDiv);
4442
4543 function _hover(xPixel, yPixel) {
@@ -57,14 +55,12 @@ describe('hoveranywhere', function () {
5755 Lib.clearThrottle();
5856 }
5957
60- it('emits plotly_hover with coordinate data on empty space', function (done) {
58+ it('emits plotly_hover with coordinate data on empty space', (done) => {
6159 var hoverData;
6260
6361 makePlot(gd, { hoveranywhere: true })
64- .then(function () {
65- gd.on('plotly_hover', function (d) {
66- hoverData = d;
67- });
62+ .then(() => {
63+ gd.on('plotly_hover', (d) => (hoverData = d));
6864
6965 // hover over empty area (no data points nearby)
7066 _hover(250, 50);
@@ -83,28 +79,24 @@ describe('hoveranywhere', function () {
8379 .then(done, done.fail);
8480 });
8581
86- it('does not emit plotly_hover event on empty space when hoveranywhere is false', function (done) {
82+ it('does not emit plotly_hover event on empty space when hoveranywhere is false', (done) => {
8783 var hoverData;
8884
8985 makePlot(gd)
90- .then(function () {
91- gd.on('plotly_hover', function (d) {
92- hoverData = d;
93- });
86+ .then(() => {
87+ gd.on('plotly_hover', (d) => (hoverData = d));
9488 _hover(250, 50);
9589 expect(hoverData).toBeUndefined();
9690 })
9791 .then(done, done.fail);
9892 });
9993
100- it('still returns normal point data on traces', function (done) {
94+ it('still returns normal point data on traces', (done) => {
10195 var hoverData;
10296
10397 makePlot(gd, { hoveranywhere: true })
104- .then(function () {
105- gd.on('plotly_hover', function (d) {
106- hoverData = d;
107- });
98+ .then(() => {
99+ gd.on('plotly_hover', (d) => (hoverData = d));
108100
109101 // hover near (2, 3)
110102 _hover(60, 210);
@@ -137,14 +129,12 @@ describe('hoveranywhere', function () {
137129 .then(done, done.fail);
138130 });
139131
140- it('respects hovermode:false', function (done) {
132+ it('respects hovermode:false', (done) => {
141133 var hoverData;
142134
143135 makePlot(gd, { hoveranywhere: true, hovermode: false })
144- .then(function () {
145- gd.on('plotly_hover', function (d) {
146- hoverData = d;
147- });
136+ .then(() => {
137+ gd.on('plotly_hover', (d) => (hoverData = d));
148138 _hover(250, 50);
149139 expect(hoverData).toBeUndefined();
150140 })
@@ -169,9 +159,7 @@ describe('hoveranywhere', function () {
169159 ]
170160 })
171161 .then(() => {
172- gd.on('plotly_hover', (d) => {
173- hoverData = d;
174- });
162+ gd.on('plotly_hover', (d) => (hoverData = d));
175163
176164 // Dispatch mousemove directly on the shape path element,
177165 // which has pointer-events that intercept events from the
@@ -220,9 +208,7 @@ describe('hoveranywhere', function () {
220208 { edits: { shapePosition: true } }
221209 )
222210 .then(() => {
223- gd.on('plotly_hover', (d) => {
224- hoverData = d;
225- });
211+ gd.on('plotly_hover', (d) => (hoverData = d));
226212
227213 const shapePath = gd.querySelector('.shape-group path');
228214 expect(shapePath).toBeDefined();
@@ -247,24 +233,20 @@ describe('hoveranywhere', function () {
247233 });
248234});
249235
250- describe('clickanywhere', function () {
236+ describe('clickanywhere', () => {
251237 'use strict';
252238
253239 var gd;
254240
255- beforeEach(function () {
256- gd = createGraphDiv();
257- });
241+ beforeEach(() => (gd = createGraphDiv()));
258242 afterEach(destroyGraphDiv);
259243
260- it('emits plotly_click with empty points on empty space', function (done) {
244+ it('emits plotly_click with empty points on empty space', (done) => {
261245 var clickData;
262246
263247 makePlot(gd, { clickanywhere: true })
264- .then(function () {
265- gd.on('plotly_click', function (d) {
266- clickData = d;
267- });
248+ .then(() => {
249+ gd.on('plotly_click', (d) => (clickData = d));
268250
269251 var bb = gd.getBoundingClientRect();
270252 var s = gd._fullLayout._size;
@@ -284,14 +266,12 @@ describe('clickanywhere', function () {
284266 .then(done, done.fail);
285267 });
286268
287- it('does not emit plotly_click event on empty space when clickanywhere is false', function (done) {
269+ it('does not emit plotly_click event on empty space when clickanywhere is false', (done) => {
288270 var clickData;
289271
290272 makePlot(gd)
291- .then(function () {
292- gd.on('plotly_click', function (d) {
293- clickData = d;
294- });
273+ .then(() => {
274+ gd.on('plotly_click', (d) => (clickData = d));
295275
296276 var bb = gd.getBoundingClientRect();
297277 var s = gd._fullLayout._size;
@@ -320,9 +300,7 @@ describe('clickanywhere', function () {
320300 ]
321301 })
322302 .then(() => {
323- gd.on('plotly_click', (d) => {
324- clickData = d;
325- });
303+ gd.on('plotly_click', (d) => (clickData = d));
326304
327305 const shapePath = gd.querySelector('.shape-group path');
328306 expect(shapePath).toBeDefined();
@@ -367,9 +345,7 @@ describe('clickanywhere', function () {
367345 { edits: { shapePosition: true } }
368346 )
369347 .then(() => {
370- gd.on('plotly_click', (d) => {
371- clickData = d;
372- });
348+ gd.on('plotly_click', (d) => (clickData = d));
373349
374350 const shapePath = gd.querySelector('.shape-group path');
375351 expect(shapePath).toBeDefined();
0 commit comments