1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/test/test_bug365410.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,134 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=365410 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 365410</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365410">Mozilla Bug 365410</a> 1.17 +<p id="display"> 1.18 +<select id="test0" multiple="multiple"> 1.19 + <option id="option">Item 1</option> 1.20 + <option>Item 2</option> 1.21 + <option>Item 3</option> 1.22 + <option>Item 4</option> 1.23 + <option>Item 5</option> 1.24 + <option>Item 6</option> 1.25 + <option>Item 7</option> 1.26 + <option>Item 8</option> 1.27 + <option>Item 9</option> 1.28 + <option>Item 10</option> 1.29 + <option>Item 11</option> 1.30 + <option>Item 12</option> 1.31 + <option>Item 13</option> 1.32 + <option>Item 14</option> 1.33 + <option>Item 15</option> 1.34 +</select> 1.35 +<select id="test1" multiple="multiple" size="1"> 1.36 + <option>Item 1</option> 1.37 + <option>Item 2</option> 1.38 + <option>Item 3</option> 1.39 + <option>Item 4</option> 1.40 + <option>Item 5</option> 1.41 + <option>Item 6</option> 1.42 + <option>Item 7</option> 1.43 + <option>Item 8</option> 1.44 + <option>Item 9</option> 1.45 + <option>Item 10</option> 1.46 + <option>Item 11</option> 1.47 + <option>Item 12</option> 1.48 + <option>Item 13</option> 1.49 + <option>Item 14</option> 1.50 + <option>Item 15</option> 1.51 +</select> 1.52 +<select id="test2" multiple="multiple" size="1" style="height:0.9em"> 1.53 + <option>Item 1</option> 1.54 + <option>Item 2</option> 1.55 + <option>Item 3</option> 1.56 + <option>Item 4</option> 1.57 + <option>Item 5</option> 1.58 + <option>Item 6</option> 1.59 + <option>Item 7</option> 1.60 + <option>Item 8</option> 1.61 + <option>Item 9</option> 1.62 + <option>Item 10</option> 1.63 + <option>Item 11</option> 1.64 + <option>Item 12</option> 1.65 + <option>Item 13</option> 1.66 + <option>Item 14</option> 1.67 + <option>Item 15</option> 1.68 +</select> 1.69 +<select id="test3" multiple="multiple" size="1"></select> 1.70 +<select id="test4" multiple="multiple" size="1" style="height:0.9em"></select> 1.71 +</p> 1.72 +<div id="content" style="display: none"> 1.73 + 1.74 +</div> 1.75 +<pre id="test"> 1.76 +<script type="application/javascript"> 1.77 + 1.78 +/** Test for Bug 365410 **/ 1.79 + 1.80 +// Turn off spatial nav so that it does not hijack the up and down events. 1.81 +SpecialPowers.setBoolPref("snav.enabled", false); 1.82 + 1.83 +function pageUpDownTest(id,index) { 1.84 + var elm = document.getElementById(id); 1.85 + elm.focus(); 1.86 + elm.selectedIndex = 0; 1.87 + sendKey("page_down"); 1.88 + sendKey("page_down"); 1.89 + sendKey("page_up"); 1.90 + sendKey("page_down"); 1.91 + is(elm.selectedIndex, index, "pageUpDownTest: selectedIndex for " + id + " is " + index); 1.92 +} 1.93 + 1.94 +function upDownTest(id,index) { 1.95 + var elm = document.getElementById(id); 1.96 + elm.focus(); 1.97 + elm.selectedIndex = 0; 1.98 + sendKey("down"); 1.99 + sendKey("down"); 1.100 + sendKey("up"); 1.101 + sendKey("down"); 1.102 + is(elm.selectedIndex, index, "upDownTest: selectedIndex for " + id + " is " + index); 1.103 +} 1.104 + 1.105 +function setHeight(id, h) { 1.106 + var elm = document.getElementById(id); 1.107 + elm.style.height = h + 'px'; 1.108 +} 1.109 + 1.110 +function runTest() { 1.111 + var h = document.getElementById("option").clientHeight; 1.112 + var list5itemsHeight = h * 5.5; 1.113 + setHeight("test0", list5itemsHeight); 1.114 + setHeight("test1", list5itemsHeight); 1.115 + setHeight("test3", list5itemsHeight); 1.116 + 1.117 + pageUpDownTest("test0",8); 1.118 + pageUpDownTest("test1",8); 1.119 + pageUpDownTest("test2",2); 1.120 + pageUpDownTest("test3",-1); 1.121 + pageUpDownTest("test4",-1); 1.122 + upDownTest("test0",2); 1.123 + upDownTest("test1",2); 1.124 + upDownTest("test2",2); 1.125 + upDownTest("test3",-1); 1.126 + upDownTest("test4",-1); 1.127 + 1.128 + SimpleTest.finish(); 1.129 +} 1.130 + 1.131 +SimpleTest.waitForExplicitFinish(); 1.132 +SimpleTest.waitForFocus(runTest) 1.133 + 1.134 +</script> 1.135 +</pre> 1.136 +</body> 1.137 +</html>