mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
The scene chrome, cockpit, Display controls, command dock, layer panels, Context rail, welcome card and Provider Settings move verbatim into src/ui/views and mount into their hosts before the page is translated and wired. Each view renders the same elements, attributes and text as its template; Vue keeps whitespace between elements as one space, and no view markup sits under a white-space: pre rule. Template asset URLs stay literal, view files are left out of Prettier so the markup is not reflowed, and the Node component loader moves to build/ and is exported as build/register-vue for host test runners. Hosts that do not initialize Core's locale pass localePicker: false instead of editing the markup.
34 lines
1.7 KiB
JavaScript
34 lines
1.7 KiB
JavaScript
import { renderApplicationHtml } from './testSupport/applicationHtml.mjs';
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const html = await renderApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8'));
|
|
const parameters = readFileSync(new URL('./ui/styleParameters.js', import.meta.url), 'utf8');
|
|
|
|
// Focused markup guards; actual computed names are checked in Chromium.
|
|
// Native labels and hidden inputs must not be treated as missing aria-labels.
|
|
test('HUD sliders and location search have descriptive explicit names', () => {
|
|
for (const [id, name] of [
|
|
['scope-feather-slider', 'Scope edge feather'],
|
|
['bloom-intensity-slider', 'Bloom intensity'],
|
|
['sharpen-intensity-slider', 'Sharpen intensity'],
|
|
['location-search', 'Search location by name or coordinates'],
|
|
]) {
|
|
const input = html.match(new RegExp(`<input\\b[^>]*\\bid="${id}"[^>]*>`))?.[0];
|
|
assert.ok(input, `${id} exists`);
|
|
assert.ok(input.includes(`aria-label="${name}"`), `${id} has its descriptive name`);
|
|
}
|
|
});
|
|
|
|
test('the first-run checkbox keeps its native visible label', () => {
|
|
// The span may carry a data-i18n extraction attribute; the native wrapping
|
|
// label contract is what this guards.
|
|
assert.match(html, /<label\b[^>]*class="first-run-suppress"[^>]*>\s*<input type="checkbox" data-first-run-suppress\s*\/?>\s*<span\b[^>]*>Don't show this again<\/span>\s*<\/label>/);
|
|
});
|
|
|
|
test('generated style sliders use the visible parameter label as their name', () => {
|
|
assert.match(parameters, /label\.textContent\s*=\s*t\(metadata\.label\);/);
|
|
assert.match(parameters, /ariaLabel:\s*t\(metadata\.label\)/);
|
|
});
|