Bug 1259949 - Caret reftests.

This commit is contained in:
Mats Palmgren 2016-04-01 02:08:15 +02:00
parent 709991c29d
commit de075da893
6 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<meta charset="utf-8">
<title>Testcase #1 for bug 1259949</title>
<script>
function test1() {
synthesizeKey("VK_DOWN", {});
// caret should now be at the start of the second line
document.body.offsetHeight;
setTimeout(function(){ document.documentElement.removeAttribute("class"); },0);
}
function runTests() {
document.querySelector('textarea').focus();
document.body.offsetHeight;
}
</script>
</head>
<body>
<textarea onfocus="test1()" spellcheck="false" style="-moz-appearance:none">abcdef
</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<meta charset="utf-8">
<title>Testcase #1 for bug 1259949</title>
<script>
function test1() {
synthesizeKey("VK_RIGHT", {});
synthesizeKey("VK_RIGHT", {});
synthesizeKey("VK_RIGHT", {}); // caret is now between "c" and "d"
synthesizeKey("VK_DOWN", {shiftKey: true}); // select "def\n"
synthesizeKey("VK_RIGHT", {}); // collapse to the end of the selection
// caret should now be at the start of the second line
document.body.offsetHeight;
setTimeout(function(){ document.documentElement.removeAttribute("class"); },0);
}
function runTests() {
document.querySelector('textarea').focus();
document.body.offsetHeight;
}
</script>
</head>
<body>
<textarea onfocus="test1()" spellcheck="false" style="-moz-appearance:none">abcdef
</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<meta charset="utf-8">
<title>Testcase #2 for bug 1259949</title>
<script>
function test1() {
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
synthesizeKey("VK_RIGHT", { });
document.body.offsetHeight;
document.documentElement.removeAttribute("class");
}
function runTests() {
document.querySelector('pre').focus();
document.body.offsetHeight;
}
</script>
</head>
<body>
<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abcdef
</pre>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<meta charset="utf-8">
<title>Testcase #2 for bug 1259949</title>
<script>
function test1() {
document.body.offsetHeight;
document.documentElement.removeAttribute("class");
}
function runTests() {
var pre = document.querySelector('pre');
window.getSelection().collapse(pre, 1/*after the text*/)
pre.focus();
document.body.offsetHeight;
}
</script>
</head>
<body onload="runTests()">
<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abcdef
<br></pre>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -43,6 +43,10 @@ support-files =
bug1258308-1-ref.html
bug1258308-2.html
bug1258308-2-ref.html
bug1259949-1.html
bug1259949-1-ref.html
bug1259949-2.html
bug1259949-2-ref.html
selection-utils.js
multi-range-user-select.html
multi-range-user-select-ref.html

View File

@ -158,6 +158,8 @@ var tests = [
[ 'bug1237236-1.html' , 'bug1237236-1-ref.html' ] ,
[ 'bug1237236-2.html' , 'bug1237236-2-ref.html' ] ,
[ 'bug1258308-2.html' , 'bug1258308-2-ref.html' ] ,
[ 'bug1259949-1.html' , 'bug1259949-1-ref.html'] ,
[ 'bug1259949-2.html' , 'bug1259949-2-ref.html'] ,
function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} ,
];