Bug 1258308 - Reftests.

This commit is contained in:
Mats Palmgren 2016-03-22 22:49:57 +01:00
parent c42a275582
commit 28c2af15f6
6 changed files with 146 additions and 0 deletions

View File

@ -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 #1 for bug 1258308</title>
<script>
function test1() {
synthesizeKey("VK_DOWN", { });
synthesizeKey("VK_DOWN", { });
// caret should now be at the start of the third 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
ghi</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!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 1258308</title>
<script>
function test1() {
const kIsMac = navigator.platform.indexOf("Mac") == 0;
synthesizeKey("VK_DOWN", {}); // go to the second line
// go to the end of the second line
if (kIsMac) {
synthesizeKey("VK_RIGHT", {accelKey: true});
} else {
synthesizeKey("VK_END", {});
}
synthesizeKey("VK_RIGHT", { shiftKey: true }); // select the newline
synthesizeKey("VK_RIGHT", {}); // collapse to the end of the selection
// caret should now be at the start of the third 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
ghi</textarea>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!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 1258308</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", { });
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
ghi</pre>
<script>
SimpleTest.waitForFocus(runTests);
</script>
</body>
</html>

View File

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

View File

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

View File

@ -157,6 +157,7 @@ var tests = [
[ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] ,
[ 'bug1237236-1.html' , 'bug1237236-1-ref.html' ] ,
[ 'bug1237236-2.html' , 'bug1237236-2-ref.html' ] ,
[ 'bug1258308-2.html' , 'bug1258308-2-ref.html' ] ,
function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} ,
];
@ -170,6 +171,7 @@ if (navigator.appVersion.indexOf("Android") == -1 &&
tests.push([ 'bug966992-2.html' , 'bug966992-2-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([ 'bug1258308-1.html' , 'bug1258308-1-ref.html' ]); // maybe VK_END doesn't work on Android?
} else {
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platform or this if..else check removed");
}