Skip to content

Commit b32c21d

Browse files
authored
Merge pull request #1593 from plotly/note-test-fix
Note test fix
2 parents 1509728 + 4a9b344 commit b32c21d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/jasmine/tests/annotations_test.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ var Plots = require('@src/plots/plots');
55
var Lib = require('@src/lib');
66
var Loggers = require('@src/lib/loggers');
77
var Axes = require('@src/plots/cartesian/axes');
8-
var constants = require('@src/plots/cartesian/constants');
8+
var HOVERMINTIME = require('@src/plots/cartesian/constants').HOVERMINTIME;
9+
var DBLCLICKDELAY = require('@src/constants/interactions').DBLCLICKDELAY;
910

1011
var d3 = require('d3');
1112
var customMatchers = require('../assets/custom_matchers');
@@ -1095,8 +1096,8 @@ describe('annotation effects', function() {
10951096
mouseEvent('mouseout', pos[0], pos[1]);
10961097
mouseEvent('mousemove', 0, 0);
10971098

1098-
setTimeout(resolve, constants.HOVERMINTIME);
1099-
}, constants.HOVERMINTIME);
1099+
setTimeout(resolve, HOVERMINTIME * 1.1);
1100+
}, HOVERMINTIME * 1.1);
11001101
});
11011102
}
11021103

@@ -1106,11 +1107,13 @@ describe('annotation effects', function() {
11061107
// so we only have to explicitly include pos0-2
11071108
spec.push([pos0Head, '']);
11081109
spec.push([pos2Head, '']);
1109-
var p = Promise.resolve();
1110-
spec.forEach(function(speci, i) {
1110+
var p = new Promise(function(resolve) {
1111+
setTimeout(resolve, HOVERMINTIME);
1112+
});
1113+
spec.forEach(function(speci) {
11111114
p = p.then(function() {
11121115
return assertHoverLabel(speci[0], speci[1],
1113-
msg ? msg + ' (' + i + ')' : i);
1116+
msg ? msg + ' (' + speci + ')' : speci);
11141117
});
11151118
});
11161119
return p;
@@ -1122,7 +1125,7 @@ describe('annotation effects', function() {
11221125

11231126
setTimeout(function() {
11241127
resolve();
1125-
}, constants.HOVERMINTIME);
1128+
}, DBLCLICKDELAY * 1.1);
11261129
});
11271130
}
11281131

@@ -1132,7 +1135,7 @@ describe('annotation effects', function() {
11321135
}
11331136

11341137
makePlot([
1135-
{x: 50, y: 50, text: 'hi', width: 50, ax: 0, ay: -40, xshift: -50, yshift: 50},
1138+
{x: 50, y: 50, text: 'hi', width: 50, height: 40, ax: 0, ay: -40, xshift: -50, yshift: 50},
11361139
{x: 20, y: 20, text: 'bye', height: 40, showarrow: false},
11371140
{x: 80, y: 80, text: 'why?', ax: 0, ay: -40}
11381141
], {}) // turn off the default editable: true

0 commit comments

Comments
 (0)