forked from leongersen/noUiSlider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider_rtl_update_options.js
31 lines (22 loc) · 1009 Bytes
/
slider_rtl_update_options.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
29
30
31
QUnit.test("RTL slider with updateOptions", function (assert) {
document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';
var slider = document.getElementById('qunit-fixture').querySelector('.slider');
noUiSlider.create(slider, {
range: {
'min': 0,
'max': 50
},
start: [10, 40],
behaviour: 'tap',
connect: true,
direction: 'rtl'
});
slider.noUiSlider.updateOptions({range: {max: 100, min: 0}})
assert.deepEqual(slider.noUiSlider.get(), ["10.00", "40.00"], "Proper start handling in RTL.");
slider.noUiSlider.set([20, 30]);
assert.deepEqual(slider.noUiSlider.get(), ["20.00", "30.00"]);
slider.noUiSlider.set([40, 45]);
assert.deepEqual(slider.noUiSlider.get(), ["40.00", "45.00"], "RTL slider overstepped properly.");
slider.noUiSlider.set([30, 35]);
assert.deepEqual(slider.noUiSlider.get(), ["30.00", "35.00"], "RTL slider understepped properly.");
});