layout/forms/test/test_bug563642.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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=563642
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 563642</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=563642">Mozilla Bug 563642</a>
michael@0 14 <p id="display">
michael@0 15 <select id="test1" multiple="multiple" size="1">
michael@0 16 <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 </select>
michael@0 22 <select id="test2" multiple="multiple" size="1">
michael@0 23 <option>Item 1</option>
michael@0 24 <option disabled>Item 2</option>
michael@0 25 <option>Item 3</option>
michael@0 26 <option disabled>Item 4</option>
michael@0 27 <option>Item 5</option>
michael@0 28 </select>
michael@0 29 <select id="test3" multiple="multiple"></select>
michael@0 30 <select id="test4" multiple="multiple" size="1"></select>
michael@0 31 </p>
michael@0 32 <div id="content" style="display: none">
michael@0 33
michael@0 34 </div>
michael@0 35 <pre id="test">
michael@0 36 <script type="application/javascript">
michael@0 37
michael@0 38 /** Test for Bug 563642 **/
michael@0 39
michael@0 40 // Turn off Spatial Navigation because it hijacks down and up key events.
michael@0 41 SpecialPowers.setBoolPref("snav.enabled", false);
michael@0 42
michael@0 43 function pageUpDownTest(id,index) {
michael@0 44 var elm = document.getElementById(id);
michael@0 45 elm.focus();
michael@0 46 elm.selectedIndex = 0;
michael@0 47 sendKey("page_down");
michael@0 48 sendKey("page_down");
michael@0 49 sendKey("page_down");
michael@0 50 sendKey("page_up");
michael@0 51 sendKey("page_down");
michael@0 52 is(elm.selectedIndex, index, "pageUpDownTest: selectedIndex for " + id + " is " + index);
michael@0 53 }
michael@0 54
michael@0 55 function upDownTest(id,index) {
michael@0 56 var elm = document.getElementById(id);
michael@0 57 elm.focus();
michael@0 58 elm.selectedIndex = 0;
michael@0 59 sendKey("down");
michael@0 60 sendKey("down");
michael@0 61 sendKey("down");
michael@0 62 sendKey("up");
michael@0 63 sendKey("down");
michael@0 64 is(elm.selectedIndex, index, "upDownTest: selectedIndex for " + id + " is " + index);
michael@0 65 }
michael@0 66
michael@0 67 function runTest() {
michael@0 68 pageUpDownTest("test1",3);
michael@0 69 pageUpDownTest("test2",4);
michael@0 70 pageUpDownTest("test3",-1);
michael@0 71 pageUpDownTest("test4",-1);
michael@0 72 upDownTest("test1",3);
michael@0 73 upDownTest("test2",4);
michael@0 74 upDownTest("test3",-1);
michael@0 75 upDownTest("test4",-1);
michael@0 76
michael@0 77 SimpleTest.finish();
michael@0 78 }
michael@0 79
michael@0 80 SimpleTest.waitForExplicitFinish();
michael@0 81 SimpleTest.waitForFocus(runTest)
michael@0 82
michael@0 83 </script>
michael@0 84 </pre>
michael@0 85 </body>
michael@0 86 </html>

mercurial