Skip to content

Commit 50df8e6

Browse files
committed
fixup waterfall jasmine test hovermode closest case and added a test to lock issue 3776
1 parent becf3df commit 50df8e6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/jasmine/tests/waterfall_test.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,13 @@ describe('waterfall hover', function() {
12571257
expect(out.style).toEqual([0, '#3D9970', 0, 13.23]);
12581258
assertPos(out.pos, [11.87, 59.33, 52.71, 52.71]);
12591259
});
1260+
1261+
it('should return the correct hover point data (case closest - decreasing case)', function() {
1262+
var out = _hover(gd, 0.8, 4, 'closest');
1263+
1264+
expect(out.style).toBeCloseToArray([1, '#FF4136', 1, -9.47]);
1265+
assertPos(out.pos, [137, 181, 266, 266]);
1266+
});
12601267
});
12611268

12621269
describe('text labels', function() {
@@ -1371,6 +1378,7 @@ describe('waterfall hover', function() {
13711378
[-3.9, 1, 'closest'],
13721379
[5.9, 1.9, 'closest'],
13731380
[-3.9, -10, 'x'],
1381+
[1, 2.1, 'closest'],
13741382
[5.9, 19, 'x']
13751383
].forEach(function(hoverSpec) {
13761384
var out = _hover(gd, hoverSpec[0], hoverSpec[1], hoverSpec[2]);
@@ -1382,7 +1390,6 @@ describe('waterfall hover', function() {
13821390
// then a few that are off the edge so yield nothing
13831391
[
13841392
[1, -0.1, 'closest'],
1385-
[1, 2.1, 'closest'],
13861393
[-4.1, 1, 'closest'],
13871394
[6.1, 1, 'closest'],
13881395
[-4.1, 1, 'x'],

0 commit comments

Comments
 (0)