summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js')
-rw-r--r--browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js43
1 files changed, 30 insertions, 13 deletions
diff --git a/browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js b/browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js
index 0f89bd5d1c..7187effdb1 100644
--- a/browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js
+++ b/browser/components/customizableui/test/browser_1856572_ensure_Fluent_works_in_customizeMode.js
@@ -10,12 +10,21 @@ const {
"resource://testing-common/FirefoxViewTestUtils.sys.mjs"
);
+/**
+ * Bug 1856572 - This test is to ensure that fluent strings in Firefox View
+ * can be updated after opening Customize Mode
+ * **/
add_task(async function test_data_l10n_customize_mode() {
FirefoxViewTestUtilsInit(this);
await withFirefoxView({ win: window }, async function (browser) {
/**
* Bug 1856572, Bug 1857622: Without requesting two animation frames
* the "missing Fluent strings" issue will not reproduce.
+ *
+ * Given the precondition that we open Firefox View, then open Customize Mode, then
+ * navigate back to Firefox View in a quick succession, as long as Fluent
+ * controlled strings can be updated by changing their Fluent IDs then this
+ * test is valid.
*/
await new Promise(r =>
requestAnimationFrame(() => requestAnimationFrame(r))
@@ -23,39 +32,47 @@ add_task(async function test_data_l10n_customize_mode() {
await startCustomizing();
await endCustomizing();
await openFirefoxViewTab(window);
-
const { document } = browser.contentWindow;
- let header = document.querySelector("h1");
- document.l10n.setAttributes(header, "firefoxview-overview-header");
+ let secondPageNavButton = document.querySelectorAll(
+ "moz-page-nav-button"
+ )[0];
+ document.l10n.setAttributes(
+ secondPageNavButton,
+ "firefoxview-overview-header"
+ );
let previousText = await document.l10n.formatValue(
- "firefoxview-page-title"
+ "firefoxview-opentabs-nav"
+ );
+ let translatedText = await window.content.document.l10n.formatValue(
+ "firefoxview-overview-header"
);
/**
* This should be replaced with
- * BrowserTestUtils.waitForMutationCondition(header, {characterData: true}, ...)
+ * BrowserTestUtils.waitForMutationCondition(secondPageNavButton, {characterData: true}, ...)
* but apparently Fluent manipulation of textContent doesn't result
* in a characterData mutation occurring.
*/
await BrowserTestUtils.waitForCondition(() => {
- return header.textContent != previousText;
+ return (
+ secondPageNavButton.textContent !== previousText &&
+ secondPageNavButton.textContent === translatedText
+ );
}, "waiting for text content to change");
Assert.equal(
- header.getAttribute("data-l10n-id"),
+ secondPageNavButton.getAttribute("data-l10n-id"),
"firefoxview-overview-header",
"data-l10n-id should be updated"
);
Assert.notEqual(
previousText,
- header.textContent,
- "The header's text content should be updated"
- );
- let translatedText = await window.content.document.l10n.formatValue(
- "firefoxview-overview-header"
+ secondPageNavButton.textContent,
+ "The second page-nav button text content should be updated"
);
+
Assert.equal(
translatedText,
- header.textContent,
+ secondPageNavButton.textContent,
"The changed text should be the translated value of 'firefoxview-overview-header"
);
});