Bug 1237236 - Reftests to check caret position after collapsing a selection to the end of a line.

This commit is contained in:
Mats Palmgren 2016-03-17 17:27:56 +01:00
Родитель 1ef2b15815
Коммит 734065f500
6 изменённых файлов: 130 добавлений и 1 удалений

Просмотреть файл

@ -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 1237236</title>
<script>
function test1() {
synthesizeKey("VK_DOWN", { }); // move caret to the second line
// 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">abc
def</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,31 @@
<!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 1237236</title>
<script>
function test1() {
synthesizeKey("VK_DOWN", { shiftKey: true }); // select first line including the newline
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">abc
def</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,32 @@
<!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 1237236</title>
<script>
function test1() {
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">abc
def</pre>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

Просмотреть файл

@ -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 1237236</title>
<script>
function test1() {
document.body.offsetHeight;
document.documentElement.removeAttribute("class");
}
function runTests() {
var pre = document.querySelector('pre');
window.getSelection().collapse(pre.firstChild, 4/*after the newline*/)
pre.focus();
document.body.offsetHeight;
}
</script>
</head>
<body>
<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abc
def</pre>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

Просмотреть файл

@ -35,6 +35,10 @@ support-files =
bug1123067-ref.html bug1123067-ref.html
bug1132768-1.html bug1132768-1.html
bug1132768-1-ref.html bug1132768-1-ref.html
bug1237236-1.html
bug1237236-1-ref.html
bug1237236-2.html
bug1237236-2-ref.html
selection-utils.js selection-utils.js
multi-range-user-select.html multi-range-user-select.html
multi-range-user-select-ref.html multi-range-user-select-ref.html

Просмотреть файл

@ -155,6 +155,8 @@ var tests = [
[ 'bug1123067-2.html' , 'bug1123067-ref.html' ] , [ 'bug1123067-2.html' , 'bug1123067-ref.html' ] ,
[ 'bug1123067-3.html' , 'bug1123067-ref.html' ] , [ 'bug1123067-3.html' , 'bug1123067-ref.html' ] ,
[ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] , [ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] ,
[ 'bug1237236-1.html' , 'bug1237236-1-ref.html' ] ,
[ 'bug1237236-2.html' , 'bug1237236-2-ref.html' ] ,
function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} , function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} ,
]; ];
@ -169,7 +171,7 @@ if (navigator.appVersion.indexOf("Android") == -1 &&
tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]); tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]);
tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['layout.css.overflow-clip-box.enabled']]}, nextTest);}); tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['layout.css.overflow-clip-box.enabled']]}, nextTest);});
} else { } else {
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed"); is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platform or this if..else check removed");
} }
if (navigator.platform.indexOf("Linux") >= 0 && if (navigator.platform.indexOf("Linux") >= 0 &&