Skip to content

Commit 73fc99e

Browse files
committed
isolate and adjust parcoord hover test
1 parent 6764876 commit 73fc99e

File tree

1 file changed

+52
-30
lines changed

1 file changed

+52
-30
lines changed

test/jasmine/tests/parcoords_test.js

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,58 @@ describe('parcoords Lifecycle methods', function() {
894894
});
895895
});
896896

897+
describe('parcoords hover', function() {
898+
var mockCopy;
899+
var gd;
900+
901+
beforeEach(function() {
902+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
903+
904+
mockCopy = Lib.extendDeep({}, mock);
905+
mockCopy.data[0].domain = {
906+
x: [0.1, 0.9],
907+
y: [0.05, 0.85]
908+
};
909+
910+
if(!mockCopy.config) mockCopy.config = {};
911+
mockCopy.config.plotGlPixelRatio = 1;
912+
913+
gd = createGraphDiv();
914+
});
915+
916+
afterEach(destroyGraphDiv);
917+
918+
it('@gl Should emit a \'plotly_hover\' event', function(done) {
919+
var hoverCalls = 0;
920+
var unhoverCalls = 0;
921+
922+
Plotly.react(gd, mockCopy)
923+
.then(function() {
924+
gd.on('plotly_hover', function() { hoverCalls++; });
925+
gd.on('plotly_unhover', function() { unhoverCalls++; });
926+
927+
expect(hoverCalls).toBe(0);
928+
expect(unhoverCalls).toBe(0);
929+
930+
mouseTo(324, 216);
931+
mouseTo(315, 218);
932+
933+
return delay(20)();
934+
})
935+
.then(function() {
936+
expect(hoverCalls).toBe(1);
937+
expect(unhoverCalls).toBe(0);
938+
mouseTo(329, 153);
939+
})
940+
.then(delay(20))
941+
.then(function() {
942+
expect(hoverCalls).toBe(1);
943+
expect(unhoverCalls).toBe(1);
944+
})
945+
.then(done, done.fail);
946+
});
947+
});
948+
897949
describe('parcoords basic use', function() {
898950
var mockCopy;
899951
var gd;
@@ -1065,36 +1117,6 @@ describe('parcoords basic use', function() {
10651117
.then(done, done.fail);
10661118
});
10671119

1068-
it('@gl Should emit a \'plotly_hover\' event', function(done) {
1069-
var hoverCalls = 0;
1070-
var unhoverCalls = 0;
1071-
1072-
Plotly.react(gd, mockCopy)
1073-
.then(function() {
1074-
gd.on('plotly_hover', function() { hoverCalls++; });
1075-
gd.on('plotly_unhover', function() { unhoverCalls++; });
1076-
1077-
expect(hoverCalls).toBe(0);
1078-
expect(unhoverCalls).toBe(0);
1079-
1080-
mouseTo(324, 216);
1081-
mouseTo(315, 218);
1082-
1083-
return delay(20)();
1084-
})
1085-
.then(function() {
1086-
expect(hoverCalls).toBe(1);
1087-
expect(unhoverCalls).toBe(0);
1088-
mouseTo(329, 153);
1089-
})
1090-
.then(delay(20))
1091-
.then(function() {
1092-
expect(hoverCalls).toBe(1);
1093-
expect(unhoverCalls).toBe(1);
1094-
})
1095-
.then(done, done.fail);
1096-
});
1097-
10981120
it('@gl Calling `Plotly.relayout` with string should amend the preexisting parcoords', function(done) {
10991121
Plotly.react(gd, mockCopy)
11001122
.then(function() {

0 commit comments

Comments
 (0)