4 <script src=
"../../../resources/js-test.js"></script>
7 <p id=
"description">Clicking middle of input type=range with padding should set the value to middle.
</p>
8 <div id=
"console"></div>
9 <input id=
"ltr" type=range min=
0 max=
50 step=
1 value=
"0" style=
"width: 100px; padding: 0 40px;">
10 <input id=
"rtl" dir=
"rtl" type=range min=
0 max=
50 step=
1 value=
"0" style=
"width: 100px; padding: 0 40px;">
11 <input id=
"vertical_ltr" type=range min=
0 max=
50 step=
1 value=
"0" style=
"-webkit-appearance:slider-vertical; width: 20px; height: 100px; padding: 40px 0;">
12 <input id=
"vertical_rtl" dir=
"rtl" type=range min=
0 max=
50 step=
1 value=
"0" style=
"-webkit-appearance:slider-vertical; width: 20px; height: 100px; padding: 40px 0;">
14 function clickHorizontalSlider(input
, offsetLeft
) {
15 var centerY
= input
.offsetTop
+ input
.offsetHeight
/ 2;
16 if (!window
.eventSender
)
18 eventSender
.mouseMoveTo(input
.offsetLeft
+ offsetLeft
, centerY
);
19 eventSender
.mouseDown();
20 eventSender
.mouseUp();
23 function clickVerticalSlider(input
, offsetTop
) {
24 var centerX
= input
.offsetLeft
+ input
.offsetWidth
/ 2;
25 if (!window
.eventSender
)
27 eventSender
.mouseMoveTo(centerX
, input
.offsetTop
+ offsetTop
);
28 eventSender
.mouseDown();
29 eventSender
.mouseUp();
32 var input_ltr
= document
.getElementById("ltr");
33 clickHorizontalSlider(input_ltr
, 90); // left padding (40px) + middle (50px)
34 shouldBe('input_ltr.value', '"25"');
36 var input_rtl
= document
.getElementById("rtl");
37 clickHorizontalSlider(input_rtl
, 90); // left padding (40px) + middle (50px)
38 shouldBe('input_rtl.value', '"25"');
40 var input_vertical_ltr
= document
.getElementById("vertical_rtl");
41 clickVerticalSlider(input_vertical_ltr
, 90); // top padding (40px) + middle (50px)
42 shouldBe('input_vertical_ltr.value', '"25"');
44 var input_vertical_rtl
= document
.getElementById("vertical_rtl");
45 clickVerticalSlider(input_vertical_rtl
, 90); // top padding (40px) + middle (50px)
46 shouldBe('input_vertical_rtl.value', '"25"');