import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { test } from 'node:test';
const html = await readFile(new URL('../index.html', import.meta.url), 'utf8');
const range = id => {
const input = html.match(new RegExp(`]*\\bid="${id}"[^>]*>`))?.[0];
assert.ok(input, `${id} is a real HTML input`);
return Object.fromEntries([...input.matchAll(/([\w-]+)="([^"]*)"/g)].map(([, key, value]) => [key, value]));
};
test('photo distance defaults to 16 within the original 0–21 percent range', () => {
const input = range('photo-glass-distance');
assert.deepEqual([input.type, input.min, input.max, input.step, input.value], ['range', '0', '21', '1', '16']);
assert.match(html, /