Skip to content

Commit 897a91d

Browse files
author
Jack Biscupski
committed
tests for range slider
1 parent d43a274 commit 897a91d

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

test/jasmine/tests/range_slider_test.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,48 @@ describe('Visible rangesliders', function() {
190190
return slide(start, sliderY, end, sliderY);
191191
})
192192
.then(function() {
193-
var maskMax = getRangeSliderChild(3);
194-
var handleMax = getRangeSliderChild(6);
193+
var maskMin = getRangeSliderChild(3);
194+
var handleMin = getRangeSliderChild(6);
195195

196196
expect(gd.layout.xaxis.range).toBeCloseToArray([0, 45.04], -0.5);
197-
expect(+maskMax.getAttribute('width')).toBeCloseTo(-diff);
198-
testTranslate1D(handleMax, dataMaxStart + diff);
197+
expect(+maskMin.getAttribute('width')).toBeCloseTo(-diff);
198+
testTranslate1D(handleMin, dataMaxStart + diff);
199+
})
200+
.catch(failTest)
201+
.then(done);
202+
});
203+
204+
it('should not exceed slider bounds left to right', function(done) {
205+
var start = 940;
206+
var end = 990;
207+
208+
plotMock().then(function() {
209+
gd._fullLayout.xaxis.d2p(49);
210+
211+
expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49]);
212+
213+
return slide(start, sliderY, end, sliderY);
214+
})
215+
.then(function() {
216+
expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49], -0.5);
217+
})
218+
.catch(failTest)
219+
.then(done);
220+
});
221+
222+
it('should not exceed slider bounds right to left', function(done) {
223+
var start = 0;
224+
var end = -50;
225+
226+
plotMock().then(function() {
227+
gd._fullLayout.xaxis.d2p(-49);
228+
229+
expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49]);
230+
231+
return slide(start, sliderY, end, sliderY);
232+
})
233+
.then(function() {
234+
expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49], -0.5);
199235
})
200236
.catch(failTest)
201237
.then(done);

0 commit comments

Comments
 (0)