forked from leongersen/noUiSlider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider_aria.js
37 lines (29 loc) · 1.34 KB
/
slider_aria.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
32
33
34
35
36
37
QUnit.test("Aria", function (assert) {
document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';
var slider = document.getElementById('qunit-fixture').querySelector('.slider');
noUiSlider.create(slider, {
start: [50, 150],
connect: true,
margin: 50,
ariaFormat: {
to: function (x) {
return Math.round(x).toString();
}, from: Number
},
range: {
'min': 50,
'max': 1050
}
});
var handle0 = slider.querySelector('[data-handle="0"]');
var handle1 = slider.querySelector('[data-handle="1"]');
assert.equal(handle0.getAttribute('role'), 'slider');
assert.equal(handle0.getAttribute('aria-valuemin'), '50.0', 'Handle0 min');
assert.equal(handle0.getAttribute('aria-valuemax'), '100.0', 'Handle0 max');
assert.equal(handle0.getAttribute('aria-valuenow'), '50.0', 'Handle0 now');
assert.equal(handle0.getAttribute('aria-valuetext'), '50', 'Handle0 txt');
assert.equal(handle1.getAttribute('aria-valuemin'), '100.0', 'Handle1 min');
assert.equal(handle1.getAttribute('aria-valuemax'), '1050.0', 'Handle1 max');
assert.equal(handle1.getAttribute('aria-valuenow'), '150.0', 'Handle1 now');
assert.equal(handle1.getAttribute('aria-valuetext'), '150', 'Handle1 txt');
});