Internationalization
This commit is contained in:
+11
-6
@@ -1,3 +1,5 @@
|
||||
import { readAppFile } from '../test-support/i18n.js';
|
||||
import { loadI18n } from '../test-support/i18n.js';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
@@ -7,7 +9,7 @@ import vm from 'node:vm';
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
|
||||
async function read(relativePath) {
|
||||
return fs.readFile(path.join(root, relativePath), 'utf8');
|
||||
return readAppFile(relativePath);
|
||||
}
|
||||
|
||||
test('start screen exposes cookie status, optional local progress and deliberate entry', async () => {
|
||||
@@ -15,13 +17,13 @@ test('start screen exposes cookie status, optional local progress and deliberate
|
||||
const loader = await read('public/js/bootstrap-loader.js');
|
||||
const storage = await read('public/js/privacy-storage.js');
|
||||
|
||||
assert.match(html, /Diese Anwendung setzt derzeit keine Cookies/);
|
||||
assert.match(html, /Wegwichtel verwendet keine Cookies/);
|
||||
assert.match(html, /class="cookie-toggle"[^>]*disabled/);
|
||||
assert.match(html, /class="progress-storage-toggle"/);
|
||||
assert.match(html, /role="switch"[^>]*aria-checked="false"/);
|
||||
assert.match(html, /id="storage-cleanup-status"/);
|
||||
assert.match(html, /id="bootstrap-enter"[^>]*hidden/);
|
||||
assert.match(loader, /Entferne alte Streckendaten aus dem Speicher \(\$\{removed\} \/ \$\{total\}\)/);
|
||||
assert.match(loader, /Alten Fortschritt löschen \(\{value1\} \/ \{value2\}\)/);
|
||||
assert.match(loader, /showReadyState\(\)/);
|
||||
assert.doesNotMatch(loader, /getElementById\('bootstrap-screen'\)\.hidden = true/);
|
||||
assert.match(loader, /event\.target\.closest\('button, input, label, a, dialog'\)/);
|
||||
@@ -40,9 +42,11 @@ test('information button opens scrollable overlay pages for privacy, imprint and
|
||||
assert.match(html, /data-info-target="privacy"/);
|
||||
assert.match(html, /data-info-target="imprint"/);
|
||||
assert.match(html, /data-info-target="technology"/);
|
||||
assert.match(html, /wegwichtel\.privacy\.v1/);
|
||||
assert.match(html, /wegwichtel\.route-progress\.v1/);
|
||||
assert.match(html, /jQuery 4\.0\.0/);
|
||||
const storage = await read('public/js/privacy-storage.js');
|
||||
assert.match(storage, /wegwichtel\.privacy\.v1/);
|
||||
assert.match(storage, /wegwichtel\.route-progress\.v1/);
|
||||
assert.match(html, /Speichern und Berechtigungen/);
|
||||
assert.doesNotMatch(html, /Local Storage|GPX|jQuery 4\.0\.0/);
|
||||
assert.match(css, /\.info-dialog-content[\s\S]*overflow-y:\s*auto/);
|
||||
assert.match(css, /\.info-dialog-content[\s\S]*touch-action:\s*pan-y/);
|
||||
assert.match(ui, /pointerup/);
|
||||
@@ -177,6 +181,7 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
CustomEvent: TestCustomEvent
|
||||
};
|
||||
context.globalThis = context;
|
||||
await loadI18n(context);
|
||||
vm.runInNewContext(source, context, { filename: sourcePath });
|
||||
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
|
||||
Reference in New Issue
Block a user