This commit is contained in:
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
|
||||
async function read(relativePath) {
|
||||
return fs.readFile(path.join(root, relativePath), 'utf8');
|
||||
}
|
||||
|
||||
test('start screen uses the presentation-style hero and one action slot', async () => {
|
||||
const html = await read('public/index.html');
|
||||
|
||||
assert.match(html, /class="bootstrap-brand"/);
|
||||
assert.match(html, /class="bootstrap-hero"/);
|
||||
assert.match(html, /class="bootstrap-features"/);
|
||||
assert.match(html, /id="bootstrap-action-status"/);
|
||||
assert.match(html, /id="bootstrap-status-text"/);
|
||||
assert.match(html, /id="bootstrap-enter"[^>]*hidden/);
|
||||
assert.match(html, />Los geht’s</);
|
||||
assert.match(html, /id="bootstrap-steps"[^>]*hidden/);
|
||||
assert.match(html, /id="bootstrap-progress"[^>]*hidden/);
|
||||
});
|
||||
|
||||
test('bootstrap status text fades between loading steps and is replaced by the start button', async () => {
|
||||
const css = await read('public/css/bootstrap.css');
|
||||
const loader = await read('public/js/bootstrap-loader.js');
|
||||
|
||||
const statusTextRule = css.match(/\.bootstrap-status-text\s*\{([\s\S]*?)\}/)?.[1] ?? '';
|
||||
const fadingRule = css.match(/\.bootstrap-status-text\.is-fading\s*\{([\s\S]*?)\}/)?.[1] ?? '';
|
||||
|
||||
assert.match(statusTextRule, /transition:\s*opacity/);
|
||||
assert.match(fadingRule, /opacity:\s*0/);
|
||||
assert.match(loader, /statusText\.classList\.add\('is-fading'\)/);
|
||||
assert.match(loader, /statusText\.classList\.remove\('is-fading'\)/);
|
||||
assert.match(loader, /server:\s*'Server prüfen …'/);
|
||||
assert.match(loader, /routes:\s*'Routen laden …'/);
|
||||
assert.match(loader, /location:\s*'Standort ermitteln …'/);
|
||||
assert.match(loader, /actionStatus\?\.classList\.add\('is-leaving'\)/);
|
||||
assert.match(loader, /enter\.classList\.add\('is-visible'\)/);
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
|
||||
async function read(relativePath) {
|
||||
return fs.readFile(path.join(root, relativePath), 'utf8');
|
||||
}
|
||||
|
||||
test('presentation example uses real GPX track points and the existing upload API', async () => {
|
||||
const gpx = await read('examples/presentation-route.gpx');
|
||||
const metadata = JSON.parse(await read('examples/presentation-route.json'));
|
||||
const script = await read('scripts/upload-presentation-route.sh');
|
||||
|
||||
assert.ok((gpx.match(/<trkpt\b/g) || []).length >= 8);
|
||||
assert.doesNotMatch(gpx, /<rtept\b/);
|
||||
assert.ok(metadata.pois.length >= 3);
|
||||
assert.match(script, /POST "\$BASE_URL\/routes"/);
|
||||
assert.match(script, /POST "\$BASE_URL\/routes\/\$ROUTE_ID\/pois"/);
|
||||
});
|
||||
Reference in New Issue
Block a user