@@ -210,6 +210,9 @@ describe('Test tickformatstops:', function() {
210
210
describe ( 'Zooming-in until milliseconds zoom level' , function ( ) {
211
211
it ( 'Zoom in' , function ( done ) {
212
212
var promise = Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) ;
213
+
214
+ var testCount = 0 ;
215
+
213
216
var zoomIn = function ( ) {
214
217
promise = promise . then ( function ( ) {
215
218
getZoomInButton ( gd ) . click ( ) ;
@@ -218,9 +221,13 @@ describe('Test tickformatstops:', function() {
218
221
var expectedLabels = xLabels . map ( function ( d ) { return formatter ( new Date ( d . x ) ) ; } ) ;
219
222
var actualLabels = xLabels . map ( function ( d ) { return d . text ; } ) ;
220
223
expect ( expectedLabels ) . toEqual ( actualLabels ) ;
224
+ testCount ++ ;
225
+
221
226
if ( gd . _fullLayout . xaxis . dtick > 1 ) {
222
227
zoomIn ( ) ;
223
228
} else {
229
+ // make sure we tested as many levels as we thought we would
230
+ expect ( testCount ) . toBe ( 32 ) ;
224
231
done ( ) ;
225
232
}
226
233
} ) ;
@@ -233,6 +240,8 @@ describe('Test tickformatstops:', function() {
233
240
it ( 'Zoom out' , function ( done ) {
234
241
var promise = Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) ;
235
242
243
+ var testCount = 0 ;
244
+
236
245
var zoomOut = function ( ) {
237
246
promise = promise . then ( function ( ) {
238
247
getZoomOutButton ( gd ) . click ( ) ;
@@ -241,10 +250,14 @@ describe('Test tickformatstops:', function() {
241
250
var expectedLabels = xLabels . map ( function ( d ) { return formatter ( new Date ( d . x ) ) ; } ) ;
242
251
var actualLabels = xLabels . map ( function ( d ) { return d . text ; } ) ;
243
252
expect ( expectedLabels ) . toEqual ( actualLabels ) ;
253
+ testCount ++ ;
254
+
244
255
if ( typeof gd . _fullLayout . xaxis . dtick === 'number' ||
245
256
typeof gd . _fullLayout . xaxis . dtick === 'string' && parseInt ( gd . _fullLayout . xaxis . dtick . replace ( / \D / g, '' ) ) < 48 ) {
246
257
zoomOut ( ) ;
247
258
} else {
259
+ // make sure we tested as many levels as we thought we would
260
+ expect ( testCount ) . toBe ( 5 ) ;
248
261
done ( ) ;
249
262
}
250
263
} ) ;
0 commit comments