OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description('<select> selection test for scrolling.'); | 10 description('<select> selection test for scrolling.'); |
(...skipping 23 matching lines...) Expand all Loading... |
34 + '<option>two</option>' | 34 + '<option>two</option>' |
35 + '<option>three</option>' | 35 + '<option>three</option>' |
36 + '</select>'; | 36 + '</select>'; |
37 document.body.appendChild(parent); | 37 document.body.appendChild(parent); |
38 | 38 |
39 // Determine the item height. | 39 // Determine the item height. |
40 var sl1 = document.getElementById('sl1'); | 40 var sl1 = document.getElementById('sl1'); |
41 var sl2 = document.getElementById('sl2'); | 41 var sl2 = document.getElementById('sl2'); |
42 var itemHeight = Math.floor(sl1.offsetHeight / sl1.size); | 42 var itemHeight = Math.floor(sl1.offsetHeight / sl1.size); |
43 sl1.removeAttribute('size'); | 43 sl1.removeAttribute('size'); |
44 var height = itemHeight * 9 + 9; | 44 var height = Math.floor(itemHeight * 9 + itemHeight / 2); |
45 sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding
: 5px;'); | 45 sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding
: 5px;'); |
46 | 46 |
47 function mouseDownOnSelect(selId, index) | 47 function mouseDownOnSelect(selId, index) |
48 { | 48 { |
49 var sl = document.getElementById(selId); | 49 var sl = document.getElementById(selId); |
50 var borderPaddingTop = 15; | 50 var borderPaddingTop = 15; |
51 var borderPaddingLeft = 15; | 51 var borderPaddingLeft = 15; |
52 var y = index * itemHeight + itemHeight / 3 - window.pageYOffset + borderPad
dingTop; | 52 var y = index * itemHeight + itemHeight / 2 - window.pageYOffset + borderPad
dingTop; |
53 var event = document.createEvent("MouseEvent"); | 53 eventSender.mouseMoveTo(sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y
); |
54 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.of
fsetLeft + borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + borderPaddingLe
ft, sl.offsetTop + y, false, false, false, false, 0, document); | 54 eventSender.mouseDown(); |
55 sl.dispatchEvent(event); | 55 eventSender.mouseUp(); |
56 } | 56 } |
57 | 57 |
58 function selectionPattern(selectId) | 58 function selectionPattern(selectId) |
59 { | 59 { |
60 var select = document.getElementById(selectId); | 60 var select = document.getElementById(selectId); |
61 var result = ""; | 61 var result = ""; |
62 for (var i = 0; i < select.options.length; i++) | 62 for (var i = 0; i < select.options.length; i++) |
63 result += select.options[i].selected ? '1' : '0'; | 63 result += select.options[i].selected ? '1' : '0'; |
64 return result; | 64 return result; |
65 } | 65 } |
(...skipping 25 matching lines...) Expand all Loading... |
91 | 91 |
92 mouseDownOnSelect("sl2", 3); | 92 mouseDownOnSelect("sl2", 3); |
93 shouldBe('selectionPattern("sl2")', '"010"'); | 93 shouldBe('selectionPattern("sl2")', '"010"'); |
94 | 94 |
95 mouseDownOnSelect("sl2", 2); | 95 mouseDownOnSelect("sl2", 2); |
96 shouldBe('selectionPattern("sl2")', '"001"'); | 96 shouldBe('selectionPattern("sl2")', '"001"'); |
97 </script> | 97 </script> |
98 <script src="../../fast/js/resources/js-test-post.js"></script> | 98 <script src="../../fast/js/resources/js-test-post.js"></script> |
99 </body> | 99 </body> |
100 </html> | 100 </html> |
OLD | NEW |