Skip to content

Commit 0e53d32

Browse files
committed
add double click test for the updated calcdata case
1 parent 8a9ed7e commit 0e53d32

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/jasmine/tests/click_test.js

+30
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,36 @@ describe('Test click interactions:', function() {
195195
done();
196196
});
197197
});
198+
199+
it('when set to \'reset+autorange\' (the default) should follow updated auto ranges', function(done) {
200+
var newAutoRangeX = [-3.004307330498139, 2.0373089852019897],
201+
newAutoRangeY = [-0.8770465137596604, 1.275194639444453];
202+
203+
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
204+
expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX);
205+
expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY);
206+
207+
return Plotly.relayout(gd, update);
208+
}).then(function() {
209+
expect(gd.layout.xaxis.range).toBeCloseToArray(zoomRangeX);
210+
expect(gd.layout.yaxis.range).toBeCloseToArray(zoomRangeY);
211+
212+
return Plotly.restyle(gd, 'y', [[1, 2, 1]]);
213+
}).then(function() {
214+
expect(gd.layout.xaxis.range).toBeCloseToArray(zoomRangeX);
215+
expect(gd.layout.yaxis.range).toBeCloseToArray(zoomRangeY);
216+
217+
return doubleClick(blankPos[0], blankPos[1]);
218+
}).then(function() {
219+
expect(gd.layout.xaxis.range).toBeCloseToArray(newAutoRangeX);
220+
expect(gd.layout.yaxis.range).toBeCloseToArray(newAutoRangeY);
221+
222+
return doubleClick(blankPos[0], blankPos[1]);
223+
}).then(function() {
224+
expect(gd.layout.xaxis.range).toBeCloseToArray(newAutoRangeX);
225+
expect(gd.layout.yaxis.range).toBeCloseToArray(newAutoRangeY);
226+
227+
done();
198228
});
199229
});
200230

0 commit comments

Comments
 (0)