Skip to content

Commit 174d2b2

Browse files
committed
add hover test when dragMode = false
‘mousemove’ events should emit ‘plotly_hover’ events
1 parent 44ac628 commit 174d2b2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/jasmine/tests/hover_label_test.js

+28
Original file line numberDiff line numberDiff line change
@@ -2785,3 +2785,31 @@ describe('touch devices', function() {
27852785
});
27862786
});
27872787
});
2788+
2789+
describe('dragmode: false', function() {
2790+
var data = [{x: [1, 2, 3], y: [1, 3, 2], type: 'bar'}];
2791+
var layout = {width: 600, height: 400, dragmode: false};
2792+
var gd;
2793+
2794+
beforeEach(function(done) {
2795+
gd = createGraphDiv();
2796+
Plotly.plot(gd, data, layout).then(done);
2797+
});
2798+
afterEach(destroyGraphDiv);
2799+
2800+
it('should emit hover events on mousemove', function(done) {
2801+
var hoverHandler = jasmine.createSpy('hover');
2802+
gd.on('plotly_hover', hoverHandler);
2803+
Promise.resolve()
2804+
.then(function() {
2805+
mouseEvent('mousemove', 105, 300);
2806+
mouseEvent('mousemove', 108, 303);
2807+
})
2808+
.then(delay(HOVERMINTIME * 1.1))
2809+
.then(function() {
2810+
expect(hoverHandler).toHaveBeenCalled();
2811+
})
2812+
.catch(failTest)
2813+
.then(done);
2814+
});
2815+
});

0 commit comments

Comments
 (0)