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 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 5 | <html> |
michael@0 | 6 | <!-- |
michael@0 | 7 | https://bugzilla.mozilla.org/show_bug.cgi?id=318065 |
michael@0 | 8 | --> |
michael@0 | 9 | |
michael@0 | 10 | <head> |
michael@0 | 11 | <title>Test for Bug 318065</title> |
michael@0 | 12 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 14 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 15 | </head> |
michael@0 | 16 | |
michael@0 | 17 | <body> |
michael@0 | 18 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=318065">Mozilla Bug 318065</a> |
michael@0 | 19 | <p id="display"></p> |
michael@0 | 20 | <div id="content" style="display: none"> |
michael@0 | 21 | </div> |
michael@0 | 22 | |
michael@0 | 23 | <pre id="test"> |
michael@0 | 24 | <script type="application/javascript"> |
michael@0 | 25 | |
michael@0 | 26 | /** Test for Bug 318065 **/ |
michael@0 | 27 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 28 | SimpleTest.waitForFocus(function() { |
michael@0 | 29 | var expectedValues = ["A", "", "A", "", "A", "", "A"]; |
michael@0 | 30 | var messages = ["Initial text inserted", |
michael@0 | 31 | "Initial text deleted", |
michael@0 | 32 | "Undo of deletion", |
michael@0 | 33 | "Redo of deletion", |
michael@0 | 34 | "Initial text typed", |
michael@0 | 35 | "Undo of typing", |
michael@0 | 36 | "Redo of typing"]; |
michael@0 | 37 | var step = 0; |
michael@0 | 38 | |
michael@0 | 39 | function onInput() { |
michael@0 | 40 | is(this.value, expectedValues[step], messages[step]); |
michael@0 | 41 | step++; |
michael@0 | 42 | if (step == expectedValues.length) { |
michael@0 | 43 | this.removeEventListener("input", onInput, false); |
michael@0 | 44 | SimpleTest.finish(); |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | var input = document.getElementById("t1"); |
michael@0 | 49 | input.addEventListener("input", onInput, false); |
michael@0 | 50 | var input2 = document.getElementById("t2"); |
michael@0 | 51 | input2.addEventListener("input", onInput, false); |
michael@0 | 52 | |
michael@0 | 53 | input.focus(); |
michael@0 | 54 | |
michael@0 | 55 | // Tests 0 + 1: Input letter and delete it again |
michael@0 | 56 | synthesizeKey("A", {}); |
michael@0 | 57 | synthesizeKey("VK_BACK_SPACE", {}); |
michael@0 | 58 | |
michael@0 | 59 | // Test 2: Undo deletion. Value of input should be "A" |
michael@0 | 60 | synthesizeKey("Z", {accelKey: true}); |
michael@0 | 61 | |
michael@0 | 62 | // Test 3: Redo deletion. Value of input should be "" |
michael@0 | 63 | synthesizeKey("Z", {accelKey: true, shiftKey: true}); |
michael@0 | 64 | |
michael@0 | 65 | input2.focus(); |
michael@0 | 66 | |
michael@0 | 67 | // Test 4: Input letter |
michael@0 | 68 | synthesizeKey("A", {}); |
michael@0 | 69 | |
michael@0 | 70 | // Test 5: Undo typing. Value of input should be "" |
michael@0 | 71 | synthesizeKey("Z", {accelKey: true}); |
michael@0 | 72 | |
michael@0 | 73 | // Test 6: Redo typing. Value of input should be "A" |
michael@0 | 74 | synthesizeKey("Z", {accelKey: true, shiftKey: true}); |
michael@0 | 75 | }); |
michael@0 | 76 | </script> |
michael@0 | 77 | </pre> |
michael@0 | 78 | |
michael@0 | 79 | <input type="text" value="" id="t1" /> |
michael@0 | 80 | <input type="text" value="" id="t2" /> |
michael@0 | 81 | </body> |
michael@0 | 82 | </html> |