overhaul gpx creation and usage
This commit is contained in:
@@ -8,6 +8,26 @@ import { localizeHtml } from '../scripts/localize-html.js';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
|
||||
test('German legal pages and contacts remain static when the app uses English', async () => {
|
||||
const context = { navigator: { language: 'en-GB' } };
|
||||
const i18n = await loadI18n(context);
|
||||
const html = await fs.readFile(path.join(root, 'public/index.html'), 'utf8');
|
||||
const englishHtml = localizeHtml(html, key => i18n.t(key));
|
||||
for (const name of ['privacy', 'imprint']) {
|
||||
const pattern = new RegExp(`<article[^>]+data-info-page="${name}"[^>]*>[\\s\\S]*?</article>`);
|
||||
const page = pattern.exec(html)?.[0];
|
||||
assert.ok(page, name);
|
||||
assert.match(page, /lang="de"/);
|
||||
assert.doesNotMatch(page, /data-i18n/);
|
||||
assert.equal(pattern.exec(englishHtml)?.[0], page);
|
||||
}
|
||||
for (const catalog of context.Wegwichtel.TextCatalogs.values()) {
|
||||
for (const key of ['privacy', 'imprint', 'contacts']) {
|
||||
assert.equal(Object.hasOwn(catalog, key), false, key);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('checked-in HTML has synchronized German defaults and accessible headings, labels and links before scripts load', async () => {
|
||||
const i18n = await loadI18n({});
|
||||
const html = await fs.readFile(path.join(root, 'public/index.html'), 'utf8');
|
||||
|
||||
Reference in New Issue
Block a user