Skip media source tests since the feature is not enabled on Windows.
[WebKit-https.git] / LayoutTests / fast / forms / listbox-respects-padding-bottom.html
1 <!DOCTYPE html>
2 <html>
3     <script src="../../resources/js-test-pre.js"></script>
4     <script>
5         description("Tests that padding-bottom is respected in non-dropdown listbox'es. Once a listbox is scrolled to its end, clicking on the padding-bottom area should hit an item only after the listbox is scrolled upwards some steps.");
6         window.jsTestIsAsync = true;
7
8         var i = 0;
9         var maxAttempts = 10;
10         function runTest()
11         {
12             var scrollAmount = 0;
13             var select = document.getElementById("sl");
14             select.scrollTop = select.scrollHeight;
15             var maxScrollOffset = select.scrollTop;
16
17             var x = select.offsetLeft + (select.offsetLeft + select.offsetWidth) / 2;
18             var y = select.offsetTop + select.offsetHeight - 15;
19
20             for ( ; i < maxAttempts; i++) {
21                  var el = document.elementFromPoint(x, y);
22                  if (el instanceof HTMLOptionElement)
23                      break;
24
25                  scrollAmount += 10;
26                  select.scrollTop = maxScrollOffset - scrollAmount;
27             }
28
29             shouldBeTrue("i > 5 && i < maxAttempts");
30             finishJSTest();
31         }
32     </script>
33     <body onload="runTest()">
34         <select id="sl" multiple="multiple" style="padding-bottom: 100px; font-size: 15px;">
35             <option>January (0)</option>
36             <option>February (1)</option>
37             <option>March (2)</option>
38             <option>April (3)</option>
39             <option>May (4)</option>
40             <option>June (5) </option>
41             <option>July (6)</option>
42             <option>August (7)</option>
43             <option>September (8)</option>
44             <option>October (9)</option>
45             <option>November (10)</option>
46             <option>December (11)</option>
47         </select>
48     </body>
49     <script src="../../resources/js-test-post.js"></script>
50 </html>