forked from leongersen/noUiSlider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider_step.js
28 lines (21 loc) · 976 Bytes
/
slider_step.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
QUnit.test("Testing handling of odd-numbered steps", function (assert) {
document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';
var slider = document.getElementById('qunit-fixture').querySelector('.slider');
noUiSlider.create(slider, {
range: {min: 3, max: 106},
start: [20, 50],
step: 10,
format: {
to: function (x) {
return Math.round(x).toString();
}, from: Number
}
});
assert.deepEqual(slider.noUiSlider.get(), ['23', '53']);
slider.noUiSlider.set([50, 106]);
assert.deepEqual(slider.noUiSlider.get(), ['53', '106'], 'Slider reached edge outside from step.');
slider.noUiSlider.set([71, 105]);
assert.deepEqual(slider.noUiSlider.get(), ['73', '103'], 'Slider steps back into stepping with lower points as origin.');
slider.noUiSlider.set([71, 101]);
assert.deepEqual(slider.noUiSlider.get(), ['73', '103']);
});