update legal documents and minor code smells
Sonarqube Scanner / Build and analyze (push) Failing after 21s

This commit is contained in:
Florian Zumpe
2026-08-31 15:56:26 +02:00
parent 74dc6be93c
commit ac4f6ebafe
5 changed files with 732 additions and 652 deletions
+17 -8
View File
@@ -18,6 +18,7 @@ test('start screen exposes cookie status, optional local progress and deliberate
assert.match(html, /Diese Anwendung setzt derzeit 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\}\)/);
@@ -34,6 +35,7 @@ test('information button opens scrollable overlay pages for privacy, imprint and
const ui = await read('public/js/legal-ui.js');
assert.match(html, /id="info-button"/);
assert.match(html, /id="info-dropdown"/);
assert.match(html, /<dialog id="info-dialog"/);
assert.match(html, /data-info-target="privacy"/);
assert.match(html, /data-info-target="imprint"/);
@@ -60,7 +62,6 @@ test('application persists current route, viewed stations and played audio only
assert.match(app, /await initializeLocation\(context\)/);
});
class FakeElement extends EventTarget {
constructor(id = '') {
super();
@@ -118,7 +119,8 @@ test('legal overlay handlers synchronize switches without advancing the start sc
['info-menu', new FakeElement('info-menu')],
['info-back', new FakeElement('info-back')],
['info-close', new FakeElement('info-close')],
['info-button', new FakeElement('info-button')]
['info-button', new FakeElement('info-button')],
['info-dropdown', new FakeElement('info-dropdown')]
]);
const content = new FakeElement();
const privacyPage = new FakeElement();
@@ -143,7 +145,8 @@ test('legal overlay handlers synchronize switches without advancing the start sc
}
const document = new EventTarget();
document.getElementById = id => elements.get(id);
document.readyState = 'complete';
document.getElementById = id => elements.get(id) || null;
document.querySelectorAll = selector => {
if (selector === '.progress-storage-toggle') return progressToggles;
if (selector === '.cookie-toggle') return cookieToggles;
@@ -177,22 +180,28 @@ test('legal overlay handlers synchronize switches without advancing the start sc
vm.runInNewContext(source, context, { filename: sourcePath });
elements.get('info-button').dispatchEvent(pointerEvent());
assert.equal(elements.get('info-dialog').open, true);
assert.equal(elements.get('info-menu').hidden, false);
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);
targetButtons[0].dispatchEvent(pointerEvent());
assert.equal(elements.get('info-dialog').open, true);
assert.equal(elements.get('info-dropdown').hidden, true);
assert.equal(elements.get('info-menu').hidden, true);
assert.equal(elements.get('info-back').hidden, true);
assert.equal(privacyPage.hidden, false);
assert.equal(elements.get('info-back').hidden, false);
assert.equal(elements.get('info-dialog-title').textContent, 'Datenschutzerklärung');
progressToggles[0].checked = true;
progressToggles[0].dispatchEvent(new Event('change'));
assert.deepEqual(changes, [true]);
assert.equal(progressToggles[0].checked, true);
assert.equal(progressToggles[1].checked, true);
assert.equal(progressToggles[0].attributes.get('aria-checked'), 'true');
assert.equal(progressToggles[1].attributes.get('aria-checked'), 'true');
assert.equal(cookieToggles[0].checked, false);
assert.equal(cookieToggles[0].attributes.get('aria-checked'), 'false');
elements.get('info-back').dispatchEvent(pointerEvent());
assert.equal(elements.get('info-menu').hidden, false);
elements.get('info-close').dispatchEvent(pointerEvent());
assert.equal(elements.get('info-dialog').open, false);
});