fune/browser/components/preferences/in-content/tests/browser_fluent.js
Zibi Braniecki 93ac8e7357 Bug 1461048 - Convert Fluent API calls to FluentDOM 0.3.0. r=mossop
MozReview-Commit-ID: K3eA8blcP2x

--HG--
extra : rebase_source : 8aca3e850d9c8f87e13aa5d1dcad588b9a272a94
2018-05-14 12:37:41 -07:00

44 lines
1.1 KiB
JavaScript

function whenMainPaneLoadedFinished() {
return new Promise(function(resolve, reject) {
const topic = "main-pane-loaded";
Services.obs.addObserver(function observer(aSubject) {
Services.obs.removeObserver(observer, topic);
resolve();
}, topic);
});
}
// Temporary test for an experimental new localization API.
// See bug 1402069 for details.
add_task(async function() {
// The string is used only when `browserTabsRemoteAutostart` is true
if (!Services.appinfo.browserTabsRemoteAutostart) {
ok(true, "fake test to avoid harness complaining");
return;
}
await Promise.all([
openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true}),
whenMainPaneLoadedFinished(),
]);
let doc = gBrowser.contentDocument;
await doc.l10n.ready;
let [ msg ] = await doc.l10n.formatMessages([
{id: "category-general"},
]);
let elem = doc.querySelector(
`#category-general`);
Assert.deepEqual(msg, {
value: null,
attributes: [
{name: "tooltiptext", value: elem.getAttribute("tooltiptext")}
]
});
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});