remove obsolete elements and cleanup gui
This commit is contained in:
@@ -322,7 +322,6 @@ async function loadApp({ language = 'de-DE' } = {}) {
|
||||
test('English browser settings localize app controls and retain user-authored trail names', async () => {
|
||||
const { context, harness } = await loadApp({ language: 'en-GB' });
|
||||
await context.Wegwichtel.App.initialize({ markStep() {} });
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Choose a trail');
|
||||
assert.equal(harness.node('#route-control-server-title').textValue, 'Public trails (1)');
|
||||
assert.equal(harness.node('#route-control-local-title').textValue, 'My drafts (1)');
|
||||
assert.match(harness.node('#location-hint').textValue, /You can still choose from all trails/);
|
||||
@@ -360,8 +359,7 @@ test('route control runtime loads server/local routes and supports switching wit
|
||||
localButton.dataValues.set('route-id', 'local-1');
|
||||
await harness.activate('[data-route-select]', localButton);
|
||||
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Lokaler Weg');
|
||||
assert.match(harness.node('#route-control-next').textValue, /Nächste Station: Lokaler Weg Start/);
|
||||
assert.equal(harness.node('#route-title').textValue, 'Lokaler Weg');
|
||||
assert.equal(harness.node('#route-page').attributes.has('hidden'), false);
|
||||
|
||||
const serverButton = new FakeNode('server-select');
|
||||
@@ -370,8 +368,7 @@ test('route control runtime loads server/local routes and supports switching wit
|
||||
await harness.key('[data-route-select]', serverButton, 'Enter');
|
||||
|
||||
assert.ok(apiCalls.includes('route:server-1'));
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Serverweg');
|
||||
assert.match(harness.node('#route-control-next').textValue, /Nächste Station: Serverweg Start/);
|
||||
assert.equal(harness.node('#route-title').textValue, 'Serverweg');
|
||||
});
|
||||
|
||||
test('local-route change refreshes an active draft and handles its later removal', async () => {
|
||||
@@ -391,7 +388,7 @@ test('local-route change refreshes an active draft and handles its later removal
|
||||
harness.document.dispatchEvent(updateEvent);
|
||||
await tick();
|
||||
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Lokaler Weg geändert');
|
||||
assert.equal(harness.node('#route-title').textValue, 'Lokaler Weg geändert');
|
||||
assert.equal(editor.refreshed, 1);
|
||||
|
||||
setup.setLocalRoute(null);
|
||||
@@ -400,7 +397,6 @@ test('local-route change refreshes an active draft and handles its later removal
|
||||
harness.document.dispatchEvent(removeEvent);
|
||||
await tick();
|
||||
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Strecke wählen');
|
||||
assert.equal(harness.node('#routes-page').attributes.has('hidden'), false);
|
||||
assert.equal(editor.refreshed, 2);
|
||||
});
|
||||
@@ -466,11 +462,9 @@ test('tracking triggers each POI once, records media progress and pauses/resumes
|
||||
await harness.activate('#start-route', new FakeNode('resume'));
|
||||
calls.position({ lat: 50.001, lon: 10.001, accuracy: 5 });
|
||||
assert.equal(calls.vibrations, 2);
|
||||
assert.equal(harness.node('#route-control-next').textValue, 'Alle Stationen erreicht');
|
||||
assert.equal(harness.node('#navigation-distance').textValue, '0 m');
|
||||
await harness.activate('#stop-route', new FakeNode('stop'));
|
||||
assert.equal(savedStates.at(-1)[1], 'idle');
|
||||
assert.equal(harness.node('#route-control-title').textValue, 'Strecke wählen');
|
||||
assert.equal(harness.node('#navigation-footer').properties.get('hidden'), true);
|
||||
assert.ok(calls.stopped >= 4);
|
||||
});
|
||||
|
||||
+26
-1
@@ -79,6 +79,10 @@ class FakeElement extends EventTarget {
|
||||
this.dataset = {};
|
||||
this.attributes = new Map();
|
||||
this.focused = false;
|
||||
this.classes = new Set();
|
||||
this.classList = {
|
||||
toggle: (name, enabled) => enabled ? this.classes.add(name) : this.classes.delete(name)
|
||||
};
|
||||
}
|
||||
|
||||
focus() {
|
||||
@@ -140,6 +144,10 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
const cookieToggles = [new FakeElement()];
|
||||
let enabled = false;
|
||||
const changes = [];
|
||||
const frames = [];
|
||||
function flushFrames() {
|
||||
while (frames.length) frames.shift()();
|
||||
}
|
||||
|
||||
class TestCustomEvent extends Event {
|
||||
constructor(type, options = {}) {
|
||||
@@ -178,7 +186,8 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
document,
|
||||
Event,
|
||||
EventTarget,
|
||||
CustomEvent: TestCustomEvent
|
||||
CustomEvent: TestCustomEvent,
|
||||
requestAnimationFrame: callback => frames.push(callback)
|
||||
};
|
||||
context.globalThis = context;
|
||||
await loadI18n(context);
|
||||
@@ -188,6 +197,22 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
assert.equal(elements.get('info-dropdown').hidden, false);
|
||||
assert.equal(elements.get('info-button').attributes.get('aria-expanded'), 'true');
|
||||
assert.equal(elements.get('info-dialog').open, false);
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
frames.shift()();
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
frames.shift()();
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), true);
|
||||
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
flushFrames();
|
||||
assert.equal(elements.get('info-dropdown').hidden, true);
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
flushFrames();
|
||||
|
||||
targetButtons[0].dispatchEvent(pointerEvent());
|
||||
assert.equal(elements.get('info-dialog').open, true);
|
||||
|
||||
@@ -18,8 +18,7 @@ test('main screen contains a persistent route control next to the information co
|
||||
assert.match(html, /class="route-control"/);
|
||||
assert.match(html, /id="route-control-button"/);
|
||||
assert.match(html, /id="route-control-dropdown"/);
|
||||
assert.match(html, /id="route-control-title"/);
|
||||
assert.match(html, /id="route-control-next"/);
|
||||
assert.doesNotMatch(html, /route-control-summary|route-control-title|route-control-next/);
|
||||
assert.match(html, /id="route-control-server-list"/);
|
||||
assert.match(html, /id="route-control-local-list"/);
|
||||
assert.match(html, /id="route-control-new"/);
|
||||
@@ -52,12 +51,12 @@ test('route selection separates activated server routes from local browser route
|
||||
assert.match(app, /\[data-route-select\]/);
|
||||
});
|
||||
|
||||
test('persistent route control displays the next unvisited Station and preserves progress when switching', async () => {
|
||||
test('route switching preserves progress and navigation continues to target unvisited stations', async () => {
|
||||
const app = await read('public/js/app.js');
|
||||
|
||||
assert.match(app, /function nextPoiMetric\(/);
|
||||
assert.match(app, /I18n\.t\("app\.next-station-summary", \{ value1: metric\.poi\.title, value2: distance \}\)/);
|
||||
assert.match(app, /state\.triggered\.has\(poi\.id\)/);
|
||||
assert.match(app, /function nearestPendingPoi\(/);
|
||||
assert.match(app, /function showPoiNavigation\(/);
|
||||
assert.match(app, /state\.triggered\.has\(metric\.poi\.id\)/);
|
||||
assert.match(app, /function suspendCurrentRoute\(/);
|
||||
assert.match(app, /persistRouteProgress\(\)/);
|
||||
assert.match(app, /await selectRoute/);
|
||||
|
||||
Reference in New Issue
Block a user