1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/test/test_bug468167.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=468167 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 468167</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468167">Mozilla Bug 468167</a> 1.17 +<p id="display"> 1.18 +<textarea id="ta" rows="10" cols="80"></textarea> 1.19 +</p> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 + 1.23 +/** Test for Bug 468167 **/ 1.24 + 1.25 +SimpleTest.waitForExplicitFinish(); 1.26 +SimpleTest.waitForFocus(runTests); 1.27 + 1.28 +function runTests() 1.29 +{ 1.30 + var ta = document.getElementById("ta"); 1.31 + ta.focus(); 1.32 + is(ta.scrollTop, 0, "initially scrolled to top"); 1.33 + var s = ""; 1.34 + for (var i = 0; i < 40; ++i) { 1.35 + // three characters per line 1.36 + if (i < 10) 1.37 + s += "0"; 1.38 + s += i + "\n"; 1.39 + } 1.40 + ta.value = s; 1.41 + is(ta.scrollTop, 0, "scrolled to top after adding content"); 1.42 + ta.scrollTop = 9999; // scroll down as far as we can 1.43 + isnot(ta.scrollTop, 0, "scrolled down after scrolling down"); 1.44 + 1.45 + ta.setSelectionRange(0, 99); // 33 lines out of 40 1.46 + 1.47 + // Send a backspace key event to delete the selection 1.48 + synthesizeKey("VK_BACK_SPACE", { }); 1.49 + 1.50 + is(ta.scrollTop, 0, "scrolled to top after deleting selection"); 1.51 + 1.52 + SimpleTest.finish(); 1.53 +} 1.54 + 1.55 +</script> 1.56 +</pre> 1.57 +</body> 1.58 +</html>