diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /toolkit/modules/tests/browser/browser_BrowserUtils.js | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests/browser/browser_BrowserUtils.js')
-rw-r--r-- | toolkit/modules/tests/browser/browser_BrowserUtils.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/toolkit/modules/tests/browser/browser_BrowserUtils.js b/toolkit/modules/tests/browser/browser_BrowserUtils.js index da28c07b69..de85566d98 100644 --- a/toolkit/modules/tests/browser/browser_BrowserUtils.js +++ b/toolkit/modules/tests/browser/browser_BrowserUtils.js @@ -21,7 +21,7 @@ add_task(async function test_getSelectionDetails_input() { content.getSelection().removeAllRanges(); let info = SelectionUtils.getSelectionDetails(content); Assert.equal(text, info.text); - Assert.ok(!info.collapsed); + Assert.strictEqual(info.docSelectionIsCollapsed, false); Assert.equal(linkURL, info.linkURL); } @@ -48,3 +48,34 @@ add_task(async function test_getSelectionDetails_input() { }); }); }); + +add_task(async function test_getSelectionDetails_shadow_selection() { + const url = kFixtureBaseURL + "file_getSelectionDetails_inputs.html"; + await SpecialPowers.pushPrefEnv({ + set: [["dom.shadowdom.selection_across_boundary.enabled", true]], + }); + await BrowserTestUtils.withNewTab({ gBrowser, url }, async browser => { + await SpecialPowers.spawn(browser, [], async () => { + function checkSelection() { + const { SelectionUtils } = ChromeUtils.importESModule( + "resource://gre/modules/SelectionUtils.sys.mjs" + ); + + const text = content.document.getElementById("outer"); + const host = content.document.getElementById("host"); + content + .getSelection() + .setBaseAndExtent( + text, + 0, + host.shadowRoot.getElementById("inner").firstChild, + 3 + ); + let info = SelectionUtils.getSelectionDetails(content); + // TODO(sefeng): verify info.text after bug 1881095 is fixed + Assert.strictEqual(info.docSelectionIsCollapsed, false); + } + checkSelection(); + }); + }); +}); |