Bug 1436431 Part 3: Add a test to ensure overflow text in the viewport is findable. r=bz
authorBrad Werth <bwerth@mozilla.com>
Wed, 25 Apr 2018 14:34:59 -0700
changeset 416912 dc092a92c289664b31977c4f5f1b986ae6a9f931
parent 416911 ec1b3f950848608328c18c0102c55305538abe36
child 416913 d462d502c26b686ce624da318ee6959b6025f169
push id33943
push usercsabou@mozilla.com
push dateFri, 04 May 2018 17:19:55 +0000
treeherdermozilla-central@ef1db4e8bf06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1436431
milestone61.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 1436431 Part 3: Add a test to ensure overflow text in the viewport is findable. r=bz MozReview-Commit-ID: BaXHJlMBmTE
toolkit/modules/tests/browser/browser.ini
toolkit/modules/tests/browser/browser_Finder_overflowed_onscreen.js
--- a/toolkit/modules/tests/browser/browser.ini
+++ b/toolkit/modules/tests/browser/browser.ini
@@ -28,16 +28,17 @@ support-files =
 
 [browser_AsyncPrefs.js]
 [browser_Battery.js]
 [browser_BrowserUtils.js]
 [browser_Deprecated.js]
 [browser_Finder.js]
 [browser_Finder_hidden_textarea.js]
 [browser_Finder_offscreen_text.js]
+[browser_Finder_overflowed_onscreen.js]
 [browser_Finder_overflowed_textarea.js]
 [browser_Finder_pointer_events_none.js]
 [browser_Finder_vertical_text.js]
 [browser_FinderHighlighter.js]
 skip-if = debug || os = "linux"
 [browser_FinderHighlighter2.js]
 skip-if = debug || os = "linux"
 [browser_Geometry.js]
new file mode 100644
--- /dev/null
+++ b/toolkit/modules/tests/browser/browser_Finder_overflowed_onscreen.js
@@ -0,0 +1,40 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+add_task(async function test_vertical_text() {
+  const URI = '<body><div style="max-height: 100px; max-width: 100px; overflow: scroll;"><div style="padding-left: 100px; max-height: 100px; max-width: 200px; overflow: auto;">d<br/><br/><br/><br/>c----------------b<br/><br/><br/><br/>a</div></div></body>';
+  await BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html;charset=utf-8," + encodeURIComponent(URI) },
+    async function(browser) {
+      let finder = browser.finder;
+      let listener = {
+        onFindResult() {
+          ok(false, "callback wasn't replaced");
+        }
+      };
+      finder.addResultListener(listener);
+
+      function waitForFind() {
+        return new Promise(resolve => {
+          listener.onFindResult = resolve;
+        });
+      }
+
+      let targets = [
+        "a",
+        "b",
+        "c",
+        "d",
+      ];
+
+      for (let i = 0; i < targets.length; ++i) {
+        // Find the target text.
+        let target = targets[i];
+        let promiseFind = waitForFind();
+        finder.fastFind(target, false, false);
+        let findResult = await promiseFind;
+        isnot(findResult.result, Ci.nsITypeAheadFind.FIND_NOTFOUND, "Found target text '" + target + "'.");
+      }
+
+      finder.removeResultListener(listener);
+    });
+});