test_bug582181-2.html (1687B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=582181 5 --> 6 <head> 7 <title>Test for Bug 582181</title> 8 <meta charset="utf-8"> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="/tests/SimpleTest/WindowSnapshot.js"></script> 11 <script src="/tests/SimpleTest/EventUtils.js"></script> 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 13 </head> 14 <body onload="test()"> 15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=582181">Mozilla Bug 582181</a> 16 <p id="display"></p> 17 <div id="content" dir="rtl"> 18 <textarea rows="5" id="testInput" style="resize:none">Blah blah 19 فلان فلان 20 <ref>ooo</ref> 21 <references /></textarea> 22 </div> 23 <pre id="test"> 24 <script class="testbody" type="text/javascript"> 25 26 /** Test for Bug 582181 */ 27 28 SimpleTest.waitForExplicitFinish(); 29 30 function test() { 31 var textInput = $("testInput"); 32 var s1, s2, s3, equal, str1, str2; 33 34 s1 = snapshotWindow(window); 35 36 textInput.focus(); 37 synthesizeKey("KEY_ArrowDown"); 38 synthesizeKey("KEY_ArrowDown"); 39 synthesizeKey("KEY_ArrowDown"); 40 synthesizeKey("KEY_ArrowDown"); 41 synthesizeKey("KEY_Backspace"); 42 textInput.blur(); 43 s2 = snapshotWindow(window); 44 45 [unequal, str1, str2] = compareSnapshots(s1, s2, false); 46 ok(unequal, "backspace after text should change rendering: got " + str2); 47 48 textInput.focus(); 49 sendString(">"); 50 textInput.blur(); 51 s3 = snapshotWindow(window); 52 53 [equal, str1, str2] = compareSnapshots(s1, s3, true); 54 ok(equal, "entering '>' should restore original rendering: expected " + str1 + 55 " but got " + str2); 56 57 SimpleTest.finish(); 58 } 59 60 </script> 61 </pre> 62 </body> 63 </html>