mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
UiCheckbox is a label wrapping a native checkbox and its words; trailing puts the box after them, as the Visual panel's rows have it. v-model shows the value and emits the checked state, and change is emitted with its event; without a modelValue the box is the browser's own, as the welcome card's "Don't show this again" is. restore puts the box back to modelValue once a change has rendered without the owner taking it, which is what the voice panel's v-checked directive did for a refused preference. Attributes go to the label; inputId and inputAttrs to the box. checkbox.css holds the centred flex row, moved out of the two labels that hold only a checkbox (first-run.css, library.css) and loaded before them. Each box keeps its skin's size, margin and accent colour. checkboxes.test.mjs fails if a view writes a checkbox by hand; Story Explore's filters are not converted yet. Co-authored-by: Manjunath Paparaju <[email protected]>
36 lines
1.9 KiB
JavaScript
36 lines
1.9 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.
|
|
// UiCheckbox leaves Vue's placeholder comment where its unused slot would be.
|
|
assert.match(html, /<label\b[^>]*class="ui-checkbox first-run-suppress"[^>]*>(?:\s*<!--v-if-->)?\s*<input type="checkbox" class="ui-checkbox__input" data-first-run-suppress\s*\/?>\s*<span\b[^>]*>Don't show this again<\/span>(?:\s*<!--v-if-->)?\s*<\/label>/);
|
|
});
|
|
|
|
test('generated style sliders use the visible parameter label as their name', () => {
|
|
assert.match(parameters, /label:\s*t\(metadata\.label\),/);
|
|
assert.match(parameters, /h\('span', \{ class: 'param-label' \}, row\.label\)/);
|
|
assert.match(parameters, /'aria-label': row\.label,/);
|
|
});
|