Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=365410 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 365410</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365410">Mozilla Bug 365410</a> |
michael@0 | 14 | <p id="display"> |
michael@0 | 15 | <select id="test0" multiple="multiple"> |
michael@0 | 16 | <option id="option">Item 1</option> |
michael@0 | 17 | <option>Item 2</option> |
michael@0 | 18 | <option>Item 3</option> |
michael@0 | 19 | <option>Item 4</option> |
michael@0 | 20 | <option>Item 5</option> |
michael@0 | 21 | <option>Item 6</option> |
michael@0 | 22 | <option>Item 7</option> |
michael@0 | 23 | <option>Item 8</option> |
michael@0 | 24 | <option>Item 9</option> |
michael@0 | 25 | <option>Item 10</option> |
michael@0 | 26 | <option>Item 11</option> |
michael@0 | 27 | <option>Item 12</option> |
michael@0 | 28 | <option>Item 13</option> |
michael@0 | 29 | <option>Item 14</option> |
michael@0 | 30 | <option>Item 15</option> |
michael@0 | 31 | </select> |
michael@0 | 32 | <select id="test1" multiple="multiple" size="1"> |
michael@0 | 33 | <option>Item 1</option> |
michael@0 | 34 | <option>Item 2</option> |
michael@0 | 35 | <option>Item 3</option> |
michael@0 | 36 | <option>Item 4</option> |
michael@0 | 37 | <option>Item 5</option> |
michael@0 | 38 | <option>Item 6</option> |
michael@0 | 39 | <option>Item 7</option> |
michael@0 | 40 | <option>Item 8</option> |
michael@0 | 41 | <option>Item 9</option> |
michael@0 | 42 | <option>Item 10</option> |
michael@0 | 43 | <option>Item 11</option> |
michael@0 | 44 | <option>Item 12</option> |
michael@0 | 45 | <option>Item 13</option> |
michael@0 | 46 | <option>Item 14</option> |
michael@0 | 47 | <option>Item 15</option> |
michael@0 | 48 | </select> |
michael@0 | 49 | <select id="test2" multiple="multiple" size="1" style="height:0.9em"> |
michael@0 | 50 | <option>Item 1</option> |
michael@0 | 51 | <option>Item 2</option> |
michael@0 | 52 | <option>Item 3</option> |
michael@0 | 53 | <option>Item 4</option> |
michael@0 | 54 | <option>Item 5</option> |
michael@0 | 55 | <option>Item 6</option> |
michael@0 | 56 | <option>Item 7</option> |
michael@0 | 57 | <option>Item 8</option> |
michael@0 | 58 | <option>Item 9</option> |
michael@0 | 59 | <option>Item 10</option> |
michael@0 | 60 | <option>Item 11</option> |
michael@0 | 61 | <option>Item 12</option> |
michael@0 | 62 | <option>Item 13</option> |
michael@0 | 63 | <option>Item 14</option> |
michael@0 | 64 | <option>Item 15</option> |
michael@0 | 65 | </select> |
michael@0 | 66 | <select id="test3" multiple="multiple" size="1"></select> |
michael@0 | 67 | <select id="test4" multiple="multiple" size="1" style="height:0.9em"></select> |
michael@0 | 68 | </p> |
michael@0 | 69 | <div id="content" style="display: none"> |
michael@0 | 70 | |
michael@0 | 71 | </div> |
michael@0 | 72 | <pre id="test"> |
michael@0 | 73 | <script type="application/javascript"> |
michael@0 | 74 | |
michael@0 | 75 | /** Test for Bug 365410 **/ |
michael@0 | 76 | |
michael@0 | 77 | // Turn off spatial nav so that it does not hijack the up and down events. |
michael@0 | 78 | SpecialPowers.setBoolPref("snav.enabled", false); |
michael@0 | 79 | |
michael@0 | 80 | function pageUpDownTest(id,index) { |
michael@0 | 81 | var elm = document.getElementById(id); |
michael@0 | 82 | elm.focus(); |
michael@0 | 83 | elm.selectedIndex = 0; |
michael@0 | 84 | sendKey("page_down"); |
michael@0 | 85 | sendKey("page_down"); |
michael@0 | 86 | sendKey("page_up"); |
michael@0 | 87 | sendKey("page_down"); |
michael@0 | 88 | is(elm.selectedIndex, index, "pageUpDownTest: selectedIndex for " + id + " is " + index); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | function upDownTest(id,index) { |
michael@0 | 92 | var elm = document.getElementById(id); |
michael@0 | 93 | elm.focus(); |
michael@0 | 94 | elm.selectedIndex = 0; |
michael@0 | 95 | sendKey("down"); |
michael@0 | 96 | sendKey("down"); |
michael@0 | 97 | sendKey("up"); |
michael@0 | 98 | sendKey("down"); |
michael@0 | 99 | is(elm.selectedIndex, index, "upDownTest: selectedIndex for " + id + " is " + index); |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | function setHeight(id, h) { |
michael@0 | 103 | var elm = document.getElementById(id); |
michael@0 | 104 | elm.style.height = h + 'px'; |
michael@0 | 105 | } |
michael@0 | 106 | |
michael@0 | 107 | function runTest() { |
michael@0 | 108 | var h = document.getElementById("option").clientHeight; |
michael@0 | 109 | var list5itemsHeight = h * 5.5; |
michael@0 | 110 | setHeight("test0", list5itemsHeight); |
michael@0 | 111 | setHeight("test1", list5itemsHeight); |
michael@0 | 112 | setHeight("test3", list5itemsHeight); |
michael@0 | 113 | |
michael@0 | 114 | pageUpDownTest("test0",8); |
michael@0 | 115 | pageUpDownTest("test1",8); |
michael@0 | 116 | pageUpDownTest("test2",2); |
michael@0 | 117 | pageUpDownTest("test3",-1); |
michael@0 | 118 | pageUpDownTest("test4",-1); |
michael@0 | 119 | upDownTest("test0",2); |
michael@0 | 120 | upDownTest("test1",2); |
michael@0 | 121 | upDownTest("test2",2); |
michael@0 | 122 | upDownTest("test3",-1); |
michael@0 | 123 | upDownTest("test4",-1); |
michael@0 | 124 | |
michael@0 | 125 | SimpleTest.finish(); |
michael@0 | 126 | } |
michael@0 | 127 | |
michael@0 | 128 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 129 | SimpleTest.waitForFocus(runTest) |
michael@0 | 130 | |
michael@0 | 131 | </script> |
michael@0 | 132 | </pre> |
michael@0 | 133 | </body> |
michael@0 | 134 | </html> |