1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/test/test_bug240933.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=240933 1.8 +--> 1.9 + 1.10 +<head> 1.11 + <title>Test for Bug 240933</title> 1.12 + <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> 1.13 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.15 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.16 +</head> 1.17 + 1.18 +<body> 1.19 + <a target="_blank" 1.20 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=240933"> 1.21 + Mozilla Bug 240933 1.22 + </a> 1.23 + <p id="display"></p> 1.24 + <div id="content" style="display: none"> 1.25 + </div> 1.26 + 1.27 + <pre id="test"> 1.28 + <script type="application/javascript"> 1.29 + 1.30 + /** Test for Bug 240933 **/ 1.31 + 1.32 + SimpleTest.waitForExplicitFinish(); 1.33 + 1.34 + SimpleTest.waitForFocus(function() { 1.35 + var t = document.getElementById("t"); 1.36 + synthesizeMouse(t, t.clientWidth / 2, 5, {}, window); 1.37 + is(t.selectionStart, 3, "The selection should be set before the newline"); 1.38 + is(t.selectionEnd, 3, "The selection should be set before the newline"); 1.39 + 1.40 + t = document.getElementById("ta"); 1.41 + t.focus(); 1.42 + t.selectionStart = t.selectionEnd = t.value.length; 1.43 + var val = t.value; 1.44 + synthesizeKey("VK_RETURN", {}); 1.45 + is(t.value, val + "\n", "Pressing enter right after focusing the textarea should work"); 1.46 + 1.47 + t = document.getElementById("tb"); 1.48 + t.focus(); 1.49 + synthesizeKey("VK_RETURN", {}); 1.50 + is(t.value, "\n", "Pressing enter for the first time should work"); 1.51 + synthesizeKey("VK_RETURN", {}); 1.52 + is(t.value, "\n\n", "Pressing enter for the second time should work"); 1.53 + synthesizeKey("VK_BACK_SPACE", {}); 1.54 + is(t.value, "\n", "Pressing backspace for the first time should work"); 1.55 + synthesizeKey("VK_BACK_SPACE", {}); 1.56 + is(t.value, "", "Pressing backspace for the second time should work"); 1.57 + SimpleTest.finish(); 1.58 + }); 1.59 + 1.60 + </script> 1.61 + </pre> 1.62 + 1.63 + <textarea id="t" rows="10" cols="10">abc 1.64 +</textarea> 1.65 + <textarea id="ta" rows="10" cols="10"> 1.66 +test 1.67 + 1.68 +</textarea> 1.69 + <textarea id="tb" rows="10" cols="10"></textarea> 1.70 + 1.71 +</body> 1.72 +</html>