Bug 1237236 - Reftests to check caret position after collapsing a selection to the end of a line.
authorMats Palmgren <mats@mozilla.com>
Thu, 17 Mar 2016 17:27:56 +0100
changeset 289186 b3b6173bf0318975bbd2b0d0ad55979d6b36a2f7
parent 289185 f245074b4fb471b12024806bc476b1f5882348c4
child 289187 2809e65fe155588e185b14585eb48cb09da7c004
push id73736
push usermpalmgren@mozilla.com
push dateThu, 17 Mar 2016 16:28:09 +0000
treeherdermozilla-inbound@2809e65fe155 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1237236
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237236 - Reftests to check caret position after collapsing a selection to the end of a line.
layout/base/tests/bug1237236-1-ref.html
layout/base/tests/bug1237236-1.html
layout/base/tests/bug1237236-2-ref.html
layout/base/tests/bug1237236-2.html
layout/base/tests/mochitest.ini
layout/base/tests/test_reftests_with_caret.html
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug1237236-1-ref.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 #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>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug1237236-1.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>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug1237236-2-ref.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>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug1237236-2.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>
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -30,16 +30,20 @@ support-files =
   bug1109968-2-ref.html
   bug1109968-2.html
   bug1123067-1.html
   bug1123067-2.html
   bug1123067-3.html
   bug1123067-ref.html
   bug1132768-1.html
   bug1132768-1-ref.html
+  bug1237236-1.html
+  bug1237236-1-ref.html
+  bug1237236-2.html
+  bug1237236-2-ref.html
   selection-utils.js
   multi-range-user-select.html
   multi-range-user-select-ref.html
   multi-range-script-select.html
   multi-range-script-select-ref.html
 
 [test_preserve3d_sorting_hit_testing.html]
 [test_preserve3d_sorting_hit_testing2.html]
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -150,31 +150,33 @@ var tests = [
     [ 'bug1061468.html'  , 'bug1061468-ref.html'  ] ,
     [ 'bug1097242-1.html', 'bug1097242-1-ref.html'] ,
     [ 'bug1109968-1.html', 'bug1109968-1-ref.html'] ,
     [ 'bug1109968-2.html', 'bug1109968-2-ref.html'] ,
     // [ 'bug1123067-1.html' , 'bug1123067-ref.html'  ] , TODO: bug 1129205
     [ 'bug1123067-2.html' , 'bug1123067-ref.html'  ] ,
     [ 'bug1123067-3.html' , 'bug1123067-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);} ,
 ];
 
 if (navigator.appVersion.indexOf("Android") == -1 &&
   SpecialPowers.Services.appinfo.name != "B2G") {
   tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);
   tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);
   tests.push([ 'bug923376.html'   , 'bug923376-ref.html'   ]);
   tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['layout.css.overflow-clip-box.enabled', true]]}, nextTest);});
   tests.push([ 'bug966992-1.html' , 'bug966992-1-ref.html' ]);
   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);});
 } 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 &&
     SpecialPowers.Services.appinfo.name != "B2G") {
   tests = tests.concat([
     // eDirPrevious, Shift+click
     [ 'multi-range-user-select.html#prev1S_' , 'multi-range-user-select-ref.html#prev1S_'  ] ,
     [ 'multi-range-user-select.html#prev2S_' , 'multi-range-user-select-ref.html#prev2S_'  ] ,