fix class usage for tests
Sonarqube Scanner / Build and analyze (push) Failing after 1m7s

This commit is contained in:
Florian Zumpe
2026-09-27 21:05:05 +02:00
parent a3e7ca16ba
commit 4b8105188f
5 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -176,7 +176,7 @@
padding: .5rem; padding: .5rem;
} }
.editor-button-icon { .editor-button img {
display: block; display: block;
height: 1.65rem; height: 1.65rem;
width: 1.65rem; width: 1.65rem;
+1 -1
View File
@@ -141,7 +141,7 @@
</section> </section>
<div class="route-control-actions"> <div class="route-control-actions">
<button id="editor-button" class="editor-button" type="button" aria-label="Streckenverwaltung öffnen" title="Streckenverwaltung öffnen" aria-haspopup="dialog" aria-expanded="false" aria-controls="editor-dialog"> <button id="editor-button" class="editor-button" type="button" aria-label="Streckenverwaltung öffnen" title="Streckenverwaltung öffnen" aria-haspopup="dialog" aria-expanded="false" aria-controls="editor-dialog">
<img class="editor-button-icon" src="images/icons/route-management.svg" alt="" aria-hidden="true"> <img src="images/icons/route-management.svg" alt="" aria-hidden="true">
</button> </button>
<button id="route-control-new" class="editor-primary-button" type="button">Neue lokale Strecke</button> <button id="route-control-new" class="editor-primary-button" type="button">Neue lokale Strecke</button>
</div> </div>
+11 -3
View File
@@ -27,6 +27,14 @@
const versioned = path => `${path}${path.includes('?') ? '&' : '?'}v=${encodeURIComponent(versions.app)}`; const versioned = path => `${path}${path.includes('?') ? '&' : '?'}v=${encodeURIComponent(versions.app)}`;
function schedule(callback, delay = 0) {
if (typeof globalThis.setTimeout === 'function') {
return globalThis.setTimeout(callback, delay);
}
callback();
return null;
}
function setStatusText(text, immediate = false) { function setStatusText(text, immediate = false) {
if (!statusText) return; if (!statusText) return;
statusTransition += 1; statusTransition += 1;
@@ -37,7 +45,7 @@
return; return;
} }
statusText.classList.add('is-fading'); statusText.classList.add('is-fading');
globalThis.setTimeout(() => { schedule(() => {
if (transition !== statusTransition) return; if (transition !== statusTransition) return;
statusText.textContent = text; statusText.textContent = text;
statusText.classList.remove('is-fading'); statusText.classList.remove('is-fading');
@@ -139,9 +147,9 @@
if (typeof globalThis.requestAnimationFrame === 'function') { if (typeof globalThis.requestAnimationFrame === 'function') {
globalThis.requestAnimationFrame(showEnter); globalThis.requestAnimationFrame(showEnter);
} else { } else {
globalThis.setTimeout(showEnter, 0); schedule(showEnter);
} }
globalThis.setTimeout(() => { schedule(() => {
if (actionStatus) actionStatus.hidden = true; if (actionStatus) actionStatus.hidden = true;
}, 220); }, 220);
enter.focus(); enter.focus();
+2
View File
@@ -41,6 +41,8 @@ test('bootstrap status text fades between loading steps and is replaced by the s
assert.match(loader, /actionStatus\?\.classList\.add\('is-leaving'\)/); assert.match(loader, /actionStatus\?\.classList\.add\('is-leaving'\)/);
assert.match(loader, /enter\.classList\.add\('is-visible'\)/); assert.match(loader, /enter\.classList\.add\('is-visible'\)/);
assert.match(loader, /const completedSteps = new Set\(\)/); assert.match(loader, /const completedSteps = new Set\(\)/);
assert.match(loader, /function schedule\(callback, delay = 0\)/);
assert.match(loader, /typeof globalThis\.setTimeout === 'function'/);
assert.doesNotMatch(loader, /dataset\.state/); assert.doesNotMatch(loader, /dataset\.state/);
assert.match(loader, /event\.stopPropagation\?\.\(\)/); assert.match(loader, /event\.stopPropagation\?\.\(\)/);
}); });
+4 -2
View File
@@ -20,7 +20,8 @@ test('editor markup and source describe local draft creation instead of immediat
const ui = await read('public/js/editor-ui.js'); const ui = await read('public/js/editor-ui.js');
assert.match(html, /id="editor-button"[^>]+aria-label="Streckenverwaltung öffnen"/); assert.match(html, /id="editor-button"[^>]+aria-label="Streckenverwaltung öffnen"/);
assert.match(html, /class="editor-button-icon"[^>]+src="images\/icons\/route-management\.svg"[^>]+alt=""/); assert.match(html, /<img[^>]+src="images\/icons\/route-management\.svg"[^>]+alt=""[^>]*>/);
assert.doesNotMatch(html, /class="editor-button-icon"/);
assert.match(html, /<dialog id="editor-dialog"/); assert.match(html, /<dialog id="editor-dialog"/);
assert.match(html, /id="editor-route-form"/); assert.match(html, /id="editor-route-form"/);
assert.match(html, /id="editor-poi-form"/); assert.match(html, /id="editor-poi-form"/);
@@ -50,7 +51,8 @@ test('editor markup and source describe local draft creation instead of immediat
assert.match(css, /\.editor-media-remove/); assert.match(css, /\.editor-media-remove/);
assert.match(css, /\.editor-danger-button/); assert.match(css, /\.editor-danger-button/);
assert.match(css, /\.editor-icon-danger/); assert.match(css, /\.editor-icon-danger/);
assert.match(css, /\.editor-button-icon/); assert.match(css, /\.editor-button\s+img/);
assert.doesNotMatch(css, /\.editor-button-icon/);
assert.match(ui, /readJson\(['"]\/routes\?activatedOnly=true['"]\)/); assert.match(ui, /readJson\(['"]\/routes\?activatedOnly=true['"]\)/);
assert.match(ui, /ns\.LocalRoutes\.save\(/); assert.match(ui, /ns\.LocalRoutes\.save\(/);