layout/forms/test/test_bug446663.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=446663
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 446663</title>
michael@0 8 <script type="text/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=446663">Mozilla Bug 446663</a>
michael@0 14 <p id="display">
michael@0 15 <style>#bug446663_a:focus{overflow:hidden}</style>
michael@0 16 <input id="bug446663_a"><input id="bug446663_b"></p>
michael@0 17 <div id="content" style="display: none">
michael@0 18
michael@0 19 </div>
michael@0 20 <pre id="test">
michael@0 21 <script class="testbody" type="text/javascript">
michael@0 22
michael@0 23 /** Test for Bug 446663 **/
michael@0 24
michael@0 25 function test_edit_cmds(id) {
michael@0 26
michael@0 27 var elm = document.getElementById(id);
michael@0 28 elm.focus();
michael@0 29 elm.select();
michael@0 30 SpecialPowers.wrap(elm).controllers.getControllerForCommand('cmd_cut')
michael@0 31 .doCommand('cmd_cut');
michael@0 32 is(elm.value, '', id + " cut");
michael@0 33
michael@0 34 SpecialPowers.wrap(elm).controllers.getControllerForCommand('cmd_undo')
michael@0 35 .doCommand('cmd_undo');
michael@0 36 is(elm.value, '123', id + " undo");
michael@0 37 }
michael@0 38
michael@0 39 var inputHappened = false;
michael@0 40 function inputListener() {
michael@0 41 inputHappened = true;
michael@0 42 $(id).removeEventListener("input", inputListener, false);
michael@0 43 }
michael@0 44
michael@0 45 var id = 'bug446663_a'
michael@0 46 var elm = document.getElementById(id);
michael@0 47 elm.focus();
michael@0 48 var x = document.body.offsetHeight;
michael@0 49 $(id).addEventListener("input", inputListener, false);
michael@0 50 sendChar('1');
michael@0 51 is(inputHappened, true, "How come no input?");
michael@0 52 sendChar('3');
michael@0 53 sendKey('LEFT')
michael@0 54 sendChar('2');
michael@0 55 elm.blur();
michael@0 56 x = document.body.offsetHeight;
michael@0 57 is(elm.value, '123', id + " edit");
michael@0 58 test_edit_cmds(id)
michael@0 59
michael@0 60 id = 'bug446663_b'
michael@0 61 elm = document.getElementById(id);
michael@0 62 elm.focus();
michael@0 63 sendChar('1');
michael@0 64 elm.style.display = 'none'
michael@0 65 var x = document.body.offsetHeight;
michael@0 66 elm.style.display = 'inline'
michael@0 67 x = document.body.offsetHeight;
michael@0 68 sendChar('3');
michael@0 69 sendKey('LEFT')
michael@0 70 sendChar('2');
michael@0 71 elm.blur();
michael@0 72 x = document.body.offsetHeight;
michael@0 73 is(elm.value, '123', id + " edit");
michael@0 74 test_edit_cmds(id)
michael@0 75
michael@0 76 </script>
michael@0 77 </pre>
michael@0 78 </body>
michael@0 79 </html>
michael@0 80

mercurial