Skip to content

Commit 86777f7

Browse files
committed
make sure the tickformatstops tests actually run as expected
1 parent 7f1fd41 commit 86777f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/jasmine/tests/tickformatstops_test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ describe('Test tickformatstops:', function() {
210210
describe('Zooming-in until milliseconds zoom level', function() {
211211
it('Zoom in', function(done) {
212212
var promise = Plotly.plot(gd, mockCopy.data, mockCopy.layout);
213+
214+
var testCount = 0;
215+
213216
var zoomIn = function() {
214217
promise = promise.then(function() {
215218
getZoomInButton(gd).click();
@@ -218,9 +221,13 @@ describe('Test tickformatstops:', function() {
218221
var expectedLabels = xLabels.map(function(d) {return formatter(new Date(d.x));});
219222
var actualLabels = xLabels.map(function(d) {return d.text;});
220223
expect(expectedLabels).toEqual(actualLabels);
224+
testCount++;
225+
221226
if(gd._fullLayout.xaxis.dtick > 1) {
222227
zoomIn();
223228
} else {
229+
// make sure we tested as many levels as we thought we would
230+
expect(testCount).toBe(32);
224231
done();
225232
}
226233
});
@@ -233,6 +240,8 @@ describe('Test tickformatstops:', function() {
233240
it('Zoom out', function(done) {
234241
var promise = Plotly.plot(gd, mockCopy.data, mockCopy.layout);
235242

243+
var testCount = 0;
244+
236245
var zoomOut = function() {
237246
promise = promise.then(function() {
238247
getZoomOutButton(gd).click();
@@ -241,10 +250,14 @@ describe('Test tickformatstops:', function() {
241250
var expectedLabels = xLabels.map(function(d) {return formatter(new Date(d.x));});
242251
var actualLabels = xLabels.map(function(d) {return d.text;});
243252
expect(expectedLabels).toEqual(actualLabels);
253+
testCount++;
254+
244255
if(typeof gd._fullLayout.xaxis.dtick === 'number' ||
245256
typeof gd._fullLayout.xaxis.dtick === 'string' && parseInt(gd._fullLayout.xaxis.dtick.replace(/\D/g, '')) < 48) {
246257
zoomOut();
247258
} else {
259+
// make sure we tested as many levels as we thought we would
260+
expect(testCount).toBe(5);
248261
done();
249262
}
250263
});

0 commit comments

Comments
 (0)