diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /toolkit/modules/tests/browser/browser_Finder_vertical_text.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests/browser/browser_Finder_vertical_text.js')
-rw-r--r-- | toolkit/modules/tests/browser/browser_Finder_vertical_text.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/toolkit/modules/tests/browser/browser_Finder_vertical_text.js b/toolkit/modules/tests/browser/browser_Finder_vertical_text.js new file mode 100644 index 0000000000..c20c4ea8f6 --- /dev/null +++ b/toolkit/modules/tests/browser/browser_Finder_vertical_text.js @@ -0,0 +1,59 @@ +/* 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 = [ + // Full matches use one path in our find code. + "vertical-rl", + "vertical-lr", + "sideways-rl", + "sideways-lr", + // Partial matches use a second path in our find code. + "l-r", + "l-l", + "s-r", + "s-l", + ]; + + 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; + + // We check the logical inversion of not not found, because found and wrapped are + // two different correct results, but not found is the only incorrect result. + isnot( + findResult.result, + Ci.nsITypeAheadFind.FIND_NOTFOUND, + "Found target text '" + target + "'." + ); + } + + finder.removeResultListener(listener); + } + ); +}); |