3 <style type=
"text/css" media=
"screen">
4 body { overflow: hidden; }
11 var results
= document
.createElement('div');
13 results
.appendChild(document
.createTextNode("Results:"));
14 document
.body
.appendChild(results
);
19 mouseDownOnSelect("sl1", 1);
20 var expectedSelectionResults
= new Array(false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
21 testResults("sl1", expectedSelectionResults
, 1);
23 mouseDownOnSelect("sl1", 6);
24 expectedSelectionResults
= new Array(false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false);
25 testResults("sl1", expectedSelectionResults
, 2);
28 function mouseDownOnSelect(selId
, index
) {
29 var sl
= document
.getElementById(selId
);
30 var itemHeight
= 14 * 1.2;
31 var borderPaddingTop
= 20 * 1.2;
32 var borderPaddingLeft
= 20 * 1.2;
33 var y
= index
* itemHeight
- window
.pageYOffset
+ borderPaddingTop
+ itemHeight
/ 2;
35 var clickX
= sl
.offsetLeft
+ borderPaddingLeft
+ 5;
36 var clickY
= sl
.offsetTop
+ y
;
37 eventSender
.mouseMoveTo(clickX
, clickY
);
38 eventSender
.mouseDown();
39 eventSender
.mouseUp();
42 function testResults(selId
, expectedArr
, testNum
) {
43 var sl
= document
.getElementById(selId
);
44 var res
= document
.getElementById('res');
45 var resultsArr
= new Array(sl
.options
.length
);
48 for (i
=0; i
< sl
.options
.length
; i
++) {
49 resultsArr
[i
] = sl
.options
[i
].selected
;
51 var successString
= "Failed";
53 if (expectedArr
.join() == resultsArr
.join()) {
55 successString
= "Passed";
58 log("Test " + testNum
+ " " + successString
);
60 log("<pre> Expected: " + expectedArr
.join() + "<br>" + " Actual: " + resultsArr
.join() + "</pre>");
65 var r
= document
.getElementById('res');
66 r
.innerHTML
= r
.innerHTML
+ "<br>" + msg
;
70 <body onload=
"test()">
72 <select id=
"sl1" multiple
style=
"height: 135px; border: 10px solid; padding: 10px;">
75 <option>three
</option>
79 <option>seven
</option>
80 <option>eight
</option>
83 <option>eleven
</option>
84 <option>twelve
</option>
85 <option>thirteen
</option>
86 <option>fourteen
</option>
87 <option>fifteen
</option>
88 <option>sixteen
</option>
89 <option>seventeen
</option>