@bigbinary/neeto-playwright-commons 4.8.11 → 4.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +14 -35
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -117433,38 +117433,22 @@ const readTranslations = () => {
|
|
|
117433
117433
|
return translations;
|
|
117434
117434
|
};
|
|
117435
117435
|
const getter = (key) => () => getI18nInstance().t(`taxonomyDefaultLabels.${key}`);
|
|
117436
|
-
const
|
|
117437
|
-
const
|
|
117438
|
-
|
|
117439
|
-
|
|
117440
|
-
|
|
117441
|
-
|
|
117442
|
-
|
|
117443
|
-
|
|
117444
|
-
|
|
117445
|
-
else if (typeof value === "object") {
|
|
117446
|
-
result[key] = replaceNullValuesWithGetter(value, transKey);
|
|
117447
|
-
}
|
|
117448
|
-
else {
|
|
117449
|
-
result[key] = value;
|
|
117450
|
-
}
|
|
117451
|
-
}
|
|
117452
|
-
return result;
|
|
117453
|
-
};
|
|
117454
|
-
const mergeTaxonomies = async (translations, page) => {
|
|
117455
|
-
const defaultTaxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
|
|
117456
|
-
const defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }]));
|
|
117457
|
-
const hostTaxonomies = (await page.evaluate(() => window.globalProps?.taxonomies));
|
|
117458
|
-
return replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
117436
|
+
const buildTaxonomies = (translations) => {
|
|
117437
|
+
const taxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
|
|
117438
|
+
return taxonomyKeys.reduce((taxonomies, key) => {
|
|
117439
|
+
taxonomies[key] = Object.defineProperties({}, {
|
|
117440
|
+
singular: { get: getter(`${key}.singular`) },
|
|
117441
|
+
plural: { get: getter(`${key}.plural`) },
|
|
117442
|
+
});
|
|
117443
|
+
return taxonomies;
|
|
117444
|
+
}, {});
|
|
117459
117445
|
};
|
|
117460
117446
|
|
|
117461
117447
|
const i18nFixture = {
|
|
117462
117448
|
i18n: [
|
|
117463
117449
|
async ({}, use) => {
|
|
117464
117450
|
const translation = readTranslations();
|
|
117465
|
-
const
|
|
117466
|
-
const page = await browser.newPage();
|
|
117467
|
-
const taxonomies = await mergeTaxonomies(translation, page);
|
|
117451
|
+
const taxonomies = buildTaxonomies(translation);
|
|
117468
117452
|
const options = {
|
|
117469
117453
|
debug: false,
|
|
117470
117454
|
fallbackLng: "en",
|
|
@@ -117490,18 +117474,13 @@ const i18nFixture = {
|
|
|
117490
117474
|
},
|
|
117491
117475
|
postProcess: ["removeTagsProcessor", "sentenceCaseProcessor"],
|
|
117492
117476
|
};
|
|
117493
|
-
const
|
|
117494
|
-
|
|
117495
|
-
options,
|
|
117496
|
-
cache: true,
|
|
117497
|
-
});
|
|
117498
|
-
await page.close();
|
|
117499
|
-
await browser.close();
|
|
117477
|
+
const plugins = [removeTagsProcessor, sentenceCaseProcessor];
|
|
117478
|
+
const i18nInitialized = await initI18n({ plugins, options, cache: true });
|
|
117500
117479
|
await use(i18nInitialized);
|
|
117501
117480
|
},
|
|
117502
|
-
{ auto: true, scope: "worker" },
|
|
117481
|
+
{ auto: true, scope: "worker", box: true },
|
|
117503
117482
|
],
|
|
117504
|
-
t: [({ i18n }, use) => use(i18n.t), { scope: "worker" }],
|
|
117483
|
+
t: [({ i18n }, use) => use(i18n.t), { scope: "worker", box: true }],
|
|
117505
117484
|
};
|
|
117506
117485
|
|
|
117507
117486
|
class ThankYouPage {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-playwright-commons",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.12",
|
|
4
4
|
"description": "A package encapsulating common playwright code across neeto projects.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
|
|
6
6
|
"license": "apache-2.0",
|