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=961363 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 961363</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | <script type="application/javascript"> |
michael@0 | 13 | /** Test for Bug 961363 **/ |
michael@0 | 14 | |
michael@0 | 15 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 16 | |
michael@0 | 17 | function test() { |
michael@0 | 18 | |
michael@0 | 19 | SimpleTest.waitForFocus(function() { |
michael@0 | 20 | var one = [{k:"DOWN",s:[false,true,true,false]}, {k:"UP",s:[false,false,true,false]}, |
michael@0 | 21 | {k:"RIGHT",s:[false,false,false,false]}, {k:"LEFT",s:[false,true,false,false]}, |
michael@0 | 22 | {k:"PAGE_DOWN",s:[false,true,false,true]}, {k:"PAGE_UP",s:[false,false,false,true]}, |
michael@0 | 23 | {k:"END",s:[false,false,false,false]}, {k:"HOME",s:[true,false,false,false]} ]; |
michael@0 | 24 | var two_1 = [{k:"DOWN",s:[false,false,true,false]}, {k:"UP",s:[false,true,false,false]}, |
michael@0 | 25 | {k:"RIGHT",s:[false,false,true,false]}, {k:"LEFT",s:[false,true,false,false]}, |
michael@0 | 26 | {k:"END",s:[false,false,false,true]}, {k:"HOME",s:[true,false,false,false]} ]; |
michael@0 | 27 | var two_2 = [{k:"PAGE_DOWN",s:[true,false,false,false]}, {k:"PAGE_UP",s:[true,false,false,false]}]; |
michael@0 | 28 | var three_1 = [{k:"DOWN",s:[false,false,true,false]}, {k:"UP",s:[false,true,false,false]}, |
michael@0 | 29 | {k:"RIGHT",s:[false,false,true,false]}, {k:"LEFT",s:[false,true,false,false]}, |
michael@0 | 30 | {k:"END",s:[false,false,false,true]}, {k:"HOME",s:[true,false,false,false]} ]; |
michael@0 | 31 | var three_2 = [{k:"PAGE_DOWN",s:[true,false,false,false]}, {k:"PAGE_UP",s:[true,false,false,false]} ]; |
michael@0 | 32 | |
michael@0 | 33 | function select_test(id, tests, ctrl_change) { |
michael@0 | 34 | var element = document.getElementById(id); |
michael@0 | 35 | element.focus(); |
michael@0 | 36 | var previousValue = element.value; |
michael@0 | 37 | tests.forEach(function(data) { |
michael@0 | 38 | var key = data.k; |
michael@0 | 39 | synthesizeKey("VK_"+key, { shiftKey:false, metaKey:false, ctrlKey:true }); |
michael@0 | 40 | (ctrl_change ? isnot : is)(element.value, previousValue, "value should " + |
michael@0 | 41 | (ctrl_change?"":"not ") + "have changed while testing CTRL+key " + key + " (id: " + id + ")"); |
michael@0 | 42 | previousValue = element.value; |
michael@0 | 43 | synthesizeKey(" ", { shiftKey:false, metaKey:false, ctrlKey:true }); |
michael@0 | 44 | var sel = Array.prototype.slice.call(element.options).map(function(o){return o.selected}) |
michael@0 | 45 | is(""+sel, ""+data.s, "selected options match after CTRL+SPACE (after testing CTRL+key " + key + ") for (id: " + id + ")"); |
michael@0 | 46 | previousValue = element.value; |
michael@0 | 47 | }); |
michael@0 | 48 | }; |
michael@0 | 49 | select_test("one", one, false); |
michael@0 | 50 | select_test("two", two_1, true); |
michael@0 | 51 | select_test("two", two_2, false); |
michael@0 | 52 | select_test("three", three_1, true); |
michael@0 | 53 | select_test("three", three_2, false); |
michael@0 | 54 | SimpleTest.finish(); |
michael@0 | 55 | }); |
michael@0 | 56 | } |
michael@0 | 57 | </script> |
michael@0 | 58 | </head> |
michael@0 | 59 | <body onload="test();"> |
michael@0 | 60 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=961363">Mozilla Bug 961363</a> |
michael@0 | 61 | <div> |
michael@0 | 62 | <ul> |
michael@0 | 63 | <li> |
michael@0 | 64 | <select id="one" multiple size="3"> |
michael@0 | 65 | <option>0</option> |
michael@0 | 66 | <option selected>1</option> |
michael@0 | 67 | <option>2</option> |
michael@0 | 68 | <option>3</option> |
michael@0 | 69 | </select> |
michael@0 | 70 | </li> |
michael@0 | 71 | <li> |
michael@0 | 72 | <select id="two" size="3"> |
michael@0 | 73 | <option>0</option> |
michael@0 | 74 | <option selected>1</option> |
michael@0 | 75 | <option>2</option> |
michael@0 | 76 | <option>3</option> |
michael@0 | 77 | </select> |
michael@0 | 78 | </li> |
michael@0 | 79 | <li> |
michael@0 | 80 | <select id="three" size="1"> |
michael@0 | 81 | <option>0</option> |
michael@0 | 82 | <option selected>1</option> |
michael@0 | 83 | <option>2</option> |
michael@0 | 84 | <option>3</option> |
michael@0 | 85 | </select> |
michael@0 | 86 | </li> |
michael@0 | 87 | </ul> |
michael@0 | 88 | </div> |
michael@0 | 89 | <pre id="test"> |
michael@0 | 90 | </pre> |
michael@0 | 91 | </body> |
michael@0 | 92 | </html> |