From a7712e985a70f525043b1a28d13fa8dec0c9d91e Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Fri, 10 Apr 2020 23:35:58 +0000 Subject: [PATCH] Bug 1621674 - Update tests to use Localization WebIDL. r=jfkthame,Mardak Differential Revision: https://phabricator.services.mozilla.com/D66549 --HG-- extra : moz-landing-system : lando --- .../test/unit/asrouter/RemoteL10n.test.js | 18 ++++++++++++------ .../dom_localization/test_attr_sanitized.html | 5 +++-- .../dom_localization/test_connectRoot.html | 5 +++-- .../test_connectRoot_webcomponent.html | 5 +++-- .../dom_localization/test_disconnectRoot.html | 5 +++-- .../dom_localization/test_domloc.xhtml | 5 +++-- .../dom_localization/test_getAttributes.html | 5 +++-- .../dom_localization/test_l10n_mutations.html | 5 +++-- .../dom_localization/test_overlay.html | 5 +++-- .../test_overlay_missing_all.html | 5 +++-- .../test_overlay_missing_children.html | 5 +++-- .../test_overlay_repeated.html | 5 +++-- .../test_overlay_sanitized.html | 5 +++-- .../test_repeated_l10nid.html | 5 +++-- .../dom_localization/test_setAttributes.html | 5 +++-- .../test_translateElements.html | 5 +++-- .../test_translateFragment.html | 5 +++-- .../dom_localization/test_translateRoots.html | 5 +++-- .../test_disconnectedRoot_webcomponent.html | 5 +++-- .../localization/test_formatMessages.html | 5 +++-- .../localization/test_formatValue.html | 5 +++-- .../localization/test_formatValues.html | 5 +++-- intl/l10n/test/test_localization.js | 19 +++++++++---------- intl/l10n/test/test_localization_sync.js | 15 +++++++-------- intl/l10n/test/test_pseudo.js | 11 ++++------- 25 files changed, 95 insertions(+), 73 deletions(-) diff --git a/browser/components/newtab/test/unit/asrouter/RemoteL10n.test.js b/browser/components/newtab/test/unit/asrouter/RemoteL10n.test.js index 114010f522b5..7552b5236469 100644 --- a/browser/components/newtab/test/unit/asrouter/RemoteL10n.test.js +++ b/browser/components/newtab/test/unit/asrouter/RemoteL10n.test.js @@ -55,30 +55,36 @@ describe("RemoteL10n", () => { assert.calledOnce(domL10nStub); const { args } = domL10nStub.firstCall; - // The first arg is the resource array, and the second one is the bundle generator. - assert.equal(args.length, 2); + // The first arg is the resource array, + // the second one is false (use async), + // and the third one is the bundle generator. + assert.equal(args.length, 3); assert.deepEqual(args[0], [ "browser/newtab/asrouter.ftl", "browser/branding/brandings.ftl", "browser/branding/sync-brand.ftl", "branding/brand.ftl", ]); - assert.isFunction(args[1]); + assert.isFalse(args[1]); + assert.isFunction(args[2].generateBundles); }); it("should load the local Fluent file if USE_REMOTE_L10N_PREF is false", () => { sandbox.stub(global.Services.prefs, "getBoolPref").returns(false); RemoteL10n._createDOML10n(); const { args } = domL10nStub.firstCall; - // The first arg is the resource array, and the second one should be null. - assert.equal(args.length, 2); + // The first arg is the resource array, + // the second one is false (use async), + // and the third one is null. + assert.equal(args.length, 3); assert.deepEqual(args[0], [ "browser/newtab/asrouter.ftl", "browser/branding/brandings.ftl", "browser/branding/sync-brand.ftl", "branding/brand.ftl", ]); - assert.isUndefined(args[1]); + assert.isFalse(args[1]); + assert.isEmpty(args[2]); }); }); }); diff --git a/dom/l10n/tests/mochitest/dom_localization/test_attr_sanitized.html b/dom/l10n/tests/mochitest/dom_localization/test_attr_sanitized.html index b61de5b223b1..19ff6aee2faa 100644 --- a/dom/l10n/tests/mochitest/dom_localization/test_attr_sanitized.html +++ b/dom/l10n/tests/mochitest/dom_localization/test_attr_sanitized.html @@ -7,7 +7,7 @@ diff --git a/dom/l10n/tests/mochitest/dom_localization/test_disconnectRoot.html b/dom/l10n/tests/mochitest/dom_localization/test_disconnectRoot.html index db91ca428f71..58279c4dece5 100644 --- a/dom/l10n/tests/mochitest/dom_localization/test_disconnectRoot.html +++ b/dom/l10n/tests/mochitest/dom_localization/test_disconnectRoot.html @@ -7,7 +7,7 @@ diff --git a/intl/l10n/test/mochitest/localization/test_formatMessages.html b/intl/l10n/test/mochitest/localization/test_formatMessages.html index e55aa32ad0a5..f682f696d528 100644 --- a/intl/l10n/test/mochitest/localization/test_formatMessages.html +++ b/intl/l10n/test/mochitest/localization/test_formatMessages.html @@ -8,7 +8,7 @@