|
1 | 1 | var Plotly = require('@lib');
|
2 | 2 | var Lib = require('@src/lib');
|
| 3 | +var Fx = require('@src/components/fx'); |
3 | 4 |
|
4 | 5 | var constants = require('@src/plots/mapbox/constants');
|
5 | 6 | var supplyLayoutDefaults = require('@src/plots/mapbox/layout_defaults');
|
@@ -1155,6 +1156,38 @@ describe('@noCI, mapbox plots', function() {
|
1155 | 1156 | .then(done);
|
1156 | 1157 | }, LONG_TIMEOUT_INTERVAL);
|
1157 | 1158 |
|
| 1159 | + it('@gl should not attempt to rehover over exiting subplots', function(done) { |
| 1160 | + spyOn(Fx, 'hover').and.callThrough(); |
| 1161 | + |
| 1162 | + function countHoverLabels() { |
| 1163 | + return d3.select('.hoverlayer').selectAll('g').size(); |
| 1164 | + } |
| 1165 | + |
| 1166 | + Promise.resolve() |
| 1167 | + .then(function() { |
| 1168 | + return _mouseEvent('mousemove', pointPos, function() { |
| 1169 | + expect(countHoverLabels()).toEqual(1); |
| 1170 | + expect(Fx.hover).toHaveBeenCalledTimes(1); |
| 1171 | + expect(Fx.hover.calls.argsFor(0)[2]).toBe('mapbox'); |
| 1172 | + Fx.hover.calls.reset(); |
| 1173 | + }); |
| 1174 | + }) |
| 1175 | + .then(function() { return Plotly.deleteTraces(gd, [0, 1]); }) |
| 1176 | + .then(delay(10)) |
| 1177 | + .then(function() { |
| 1178 | + return _mouseEvent('mousemove', pointPos, function() { |
| 1179 | + expect(countHoverLabels()).toEqual(0); |
| 1180 | + // N.B. no additional calls from Plots.rehover() |
| 1181 | + // (as 'mapbox' subplot is gone), |
| 1182 | + // just one on the fallback xy subplot |
| 1183 | + expect(Fx.hover).toHaveBeenCalledTimes(1); |
| 1184 | + expect(Fx.hover.calls.argsFor(0)[2]).toBe('xy'); |
| 1185 | + }); |
| 1186 | + }) |
| 1187 | + .catch(failTest) |
| 1188 | + .then(done); |
| 1189 | + }, LONG_TIMEOUT_INTERVAL); |
| 1190 | + |
1158 | 1191 | it('@gl should respond drag / scroll / double-click interactions', function(done) {
|
1159 | 1192 | var relayoutCnt = 0;
|
1160 | 1193 | var doubleClickCnt = 0;
|
|
0 commit comments