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=672810 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 672810</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/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=672810">Mozilla Bug 672810</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content"> |
michael@0 | 16 | <select id="s1" multiple size="10"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select> |
michael@0 | 17 | <select id="s2" size="10"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select> |
michael@0 | 18 | <select id="s3" size="1"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select> |
michael@0 | 19 | </div> |
michael@0 | 20 | <pre id="test"> |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | |
michael@0 | 23 | /** Test for Bug 672810 **/ |
michael@0 | 24 | |
michael@0 | 25 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 26 | |
michael@0 | 27 | SimpleTest.waitForFocus(function() { |
michael@0 | 28 | var sel = document.getElementsByTagName('select'); |
michael@0 | 29 | |
michael@0 | 30 | sel[0].addEventListener('focus', function() { |
michael@0 | 31 | s = sel[0]; |
michael@0 | 32 | s.removeEventListener('focus', arguments.callee, false); |
michael@0 | 33 | synthesizeKey('VK_DOWN', {}); |
michael@0 | 34 | is(s.selectedIndex,0, s.id + ": initial DOWN selects first option"); |
michael@0 | 35 | synthesizeKey('VK_DOWN', {ctrlKey: true}); |
michael@0 | 36 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 37 | ok(!s[1].selected,s.id + ": CTRL+DOWN did not select 2nd option"); |
michael@0 | 38 | synthesizeKey('VK_DOWN', {ctrlKey: true}); |
michael@0 | 39 | synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true}); |
michael@0 | 40 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 41 | ok(!s[1].selected,s.id + ": 2nd option is still unselected"); |
michael@0 | 42 | ok(s[2].selected,s.id + ": 3rd option is selected"); |
michael@0 | 43 | ok(s[3].selected,s.id + ": 4th option is selected"); |
michael@0 | 44 | ok(!s[4].selected,s.id + ": 5th option is unselected"); |
michael@0 | 45 | synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true}); |
michael@0 | 46 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 47 | ok(!s[1].selected,s.id + ": 2nd option is still unselected"); |
michael@0 | 48 | ok(s[2].selected,s.id + ": 3rd option is still selected"); |
michael@0 | 49 | ok(s[3].selected,s.id + ": 4th option is still selected"); |
michael@0 | 50 | ok(s[4].selected,s.id + ": 5th option is selected"); |
michael@0 | 51 | ok(!s[5].selected,s.id + ": 6th option is unselected"); |
michael@0 | 52 | synthesizeKey('VK_UP', {ctrlKey: true, shiftKey: true}); |
michael@0 | 53 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 54 | ok(!s[1].selected,s.id + ": 2nd option is still unselected"); |
michael@0 | 55 | ok(s[2].selected,s.id + ": 3rd option is still selected"); |
michael@0 | 56 | ok(s[3].selected,s.id + ": 4th option is still selected"); |
michael@0 | 57 | ok(s[4].selected,s.id + ": 5th option is still selected"); |
michael@0 | 58 | ok(!s[5].selected,s.id + ": 6th option is still unselected"); |
michael@0 | 59 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 60 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 61 | ok(!s[1].selected,s.id + ": 2nd option is still unselected"); |
michael@0 | 62 | ok(s[2].selected,s.id + ": 3rd option is still selected"); |
michael@0 | 63 | ok(!s[3].selected,s.id + ": 4th option is unselected"); |
michael@0 | 64 | ok(s[4].selected,s.id + ": 5th option is still selected"); |
michael@0 | 65 | ok(!s[5].selected,s.id + ": 6th option is still unselected"); |
michael@0 | 66 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 67 | is(s.selectedIndex,0, s.id + ": first option is still selected"); |
michael@0 | 68 | ok(!s[1].selected,s.id + ": 2nd option is still unselected"); |
michael@0 | 69 | ok(s[2].selected,s.id + ": 3rd option is still selected"); |
michael@0 | 70 | ok(s[3].selected,s.id + ": 4th option is selected"); |
michael@0 | 71 | ok(s[4].selected,s.id + ": 5th option is still selected"); |
michael@0 | 72 | ok(!s[5].selected,s.id + ": 6th option is still unselected"); |
michael@0 | 73 | setTimeout(function(){sel[1].focus()},0); |
michael@0 | 74 | }, false); |
michael@0 | 75 | sel[1].addEventListener('focus', function() { |
michael@0 | 76 | s = sel[1]; |
michael@0 | 77 | s.removeEventListener('focus', arguments.callee, false); |
michael@0 | 78 | synthesizeKey('VK_DOWN', {}); |
michael@0 | 79 | is(s.selectedIndex,0, s.id + ": initial DOWN selects first option"); |
michael@0 | 80 | synthesizeKey('VK_DOWN', {ctrlKey: true}); |
michael@0 | 81 | is(s.selectedIndex,1, s.id + ": 2nd option is selected"); |
michael@0 | 82 | ok(!s[0].selected,s.id + ": CTRL+DOWN deselected first option"); |
michael@0 | 83 | synthesizeKey('VK_DOWN', {ctrlKey: true}); |
michael@0 | 84 | synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true}); |
michael@0 | 85 | is(s.selectedIndex,3, s.id + ": 4th option is selected"); |
michael@0 | 86 | ok(!s[1].selected,s.id + ": CTRL+SHIFT+DOWN deselected 2nd option"); |
michael@0 | 87 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 88 | is(s.selectedIndex,3, s.id + ": 4th option is still selected"); |
michael@0 | 89 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 90 | is(s.selectedIndex,3, s.id + ": 4th option is still selected"); |
michael@0 | 91 | setTimeout(function(){sel[2].focus()},0); |
michael@0 | 92 | }, false); |
michael@0 | 93 | sel[2].addEventListener('focus', function() { |
michael@0 | 94 | s = sel[2]; |
michael@0 | 95 | s.removeEventListener('focus', arguments.callee, false); |
michael@0 | 96 | synthesizeKey('VK_DOWN', {}); |
michael@0 | 97 | is(s.selectedIndex,1, s.id + ": initial DOWN selects 2nd option"); |
michael@0 | 98 | synthesizeKey('VK_DOWN', {ctrlKey: true}); |
michael@0 | 99 | is(s.selectedIndex,2, s.id + ": 3rd option is selected"); |
michael@0 | 100 | ok(!s[1].selected,s.id + ": CTRL+DOWN deselected 2nd option"); |
michael@0 | 101 | synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true}); |
michael@0 | 102 | is(s.selectedIndex,3, s.id + ": 4th option is selected"); |
michael@0 | 103 | ok(!s[2].selected,s.id + ": CTRL+SHIFT+DOWN deselected 3rd option"); |
michael@0 | 104 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 105 | is(s.selectedIndex,3, s.id + ": 4th option is still selected"); |
michael@0 | 106 | synthesizeKey(' ', {ctrlKey: true, shiftKey: true}); |
michael@0 | 107 | is(s.selectedIndex,3, s.id + ": 4th option is still selected"); |
michael@0 | 108 | setTimeout(function(){SimpleTest.finish()},0); |
michael@0 | 109 | }, false); |
michael@0 | 110 | sel[0].focus(); |
michael@0 | 111 | }); |
michael@0 | 112 | |
michael@0 | 113 | </script> |
michael@0 | 114 | </pre> |
michael@0 | 115 | </body> |
michael@0 | 116 | </html> |