Bug 1437509 Part 2: Add a test to ensure we can find vertical text. r=mikedeboer a=test-only
authorBrad Werth <bwerth@mozilla.com>
Thu, 08 Mar 2018 14:16:48 -0800
changeset 463375 28ef3feed53a152327570e700ffa83d9dc0a5baf
parent 463374 20d2e80aa71b8fcefbe5e72d203007909810db03
child 463376 2a0555131c04bffedb7a71be27ca97a3f8303d92
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs1437509
milestone60.0
Bug 1437509 Part 2: Add a test to ensure we can find vertical text. r=mikedeboer a=test-only MozReview-Commit-ID: Kh5HKzo2hsB
toolkit/modules/tests/browser/browser.ini
toolkit/modules/tests/browser/browser_Finder_vertical_text.js
--- a/toolkit/modules/tests/browser/browser.ini
+++ b/toolkit/modules/tests/browser/browser.ini
@@ -30,16 +30,17 @@ support-files =
 [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_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]
 [browser_InlineSpellChecker.js]
 [browser_WebNavigation.js]
 skip-if = true # Superseded by WebExtension tests
new file mode 100644
--- /dev/null
+++ b/toolkit/modules/tests/browser/browser_Finder_vertical_text.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="writing-mode: vertical-rl">vertical-rl</div><div style="writing-mode: vertical-lr">vertical-lr</div><div style="writing-mode: sideways-rl">sideways-rl</div><div style="writing-mode: sideways-lr">sideways-lr</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 = [
+        "vertical-rl",
+        "vertical-lr",
+        "sideways-rl",
+        "sideways-lr",
+      ];
+
+      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;
+        is(findResult.result, Ci.nsITypeAheadFind.FIND_FOUND, "Found target text '" + target + "'.");
+      }
+
+      finder.removeResultListener(listener);
+    });
+});