Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
73 lines
4.4 KiB
JavaScript
73 lines
4.4 KiB
JavaScript
window.addEventListener('load', async () => {
|
|
const wait = async check => {
|
|
for (let i = 0; i < 150; i++) {
|
|
if (check()) return;
|
|
await new Promise(resolve => setTimeout(resolve, 30));
|
|
}
|
|
throw new Error('City label fixture did not finish rendering');
|
|
};
|
|
const checkLabels = selector => {
|
|
const labels = [...document.querySelectorAll(selector)];
|
|
if (!labels.length) throw new Error('Missing labels: ' + selector);
|
|
for (const label of labels) {
|
|
const style = getComputedStyle(label), matrix = label.getScreenCTM();
|
|
if (style.display === 'none' || Number(style.opacity) < .99 || !label.textContent.trim())
|
|
throw new Error('Label hidden without hover: ' + label.textContent);
|
|
if (label.querySelector('textPath') || !matrix || Math.abs(matrix.b) > .001 || Math.abs(matrix.c) > .001)
|
|
throw new Error('Rotated label: ' + label.textContent);
|
|
}
|
|
};
|
|
const activate = element => element.dispatchEvent(new MouseEvent('click', {bubbles:true}));
|
|
const toggleLabels = checked => {
|
|
const input = document.querySelector('[data-city-labels]');
|
|
input.checked = checked;
|
|
input.dispatchEvent(new Event('change', {bubbles:true}));
|
|
};
|
|
try {
|
|
await wait(() => document.querySelector('.city-quartier-tile'));
|
|
checkLabels('.city-scene-title');
|
|
activate(document.querySelector('.city-quartier-tile'));
|
|
await wait(() => document.querySelectorAll('.city-generated-street-label').length === 2);
|
|
if (document.querySelector('.city-node:hover')) throw new Error('Fixture must begin without hover');
|
|
checkLabels('.city-generated-street-label');
|
|
// Keyboard focus still highlights a road without hiding its neighbors.
|
|
const street = document.querySelector('.city-street-tile');
|
|
const restingStroke = getComputedStyle(street.querySelector('.city-generated-street-hit')).stroke;
|
|
street.focus();
|
|
await wait(() => getComputedStyle(street.querySelector('.city-generated-street-hit')).stroke !== restingStroke);
|
|
checkLabels('.city-generated-street-label');
|
|
street.blur();
|
|
toggleLabels(false);
|
|
if ([...document.querySelectorAll('.city-generated-street-label')].some(label => getComputedStyle(label).display !== 'none'))
|
|
throw new Error('Labels toggle does not hide Streets');
|
|
toggleLabels(true);
|
|
checkLabels('.city-generated-street-label');
|
|
activate(document.querySelector('.city-street-tile'));
|
|
await wait(() => document.querySelector('.city-undefined-page-label'));
|
|
const entrance = document.querySelector('.city-spot-point-label');
|
|
if (!entrance || /undefined|未定義|未分類/i.test(entrance.textContent)) throw new Error('Internal placeholder label is visible');
|
|
activate(document.querySelector('.city-spot-entry'));
|
|
await wait(() => document.querySelector('.city-spot-monument'));
|
|
if (document.querySelector('[data-city-trail] [aria-current="location"]')?.textContent !== entrance.querySelector('title')?.textContent) throw new Error('Spot breadcrumb differs from display title');
|
|
activate(document.querySelector('[data-city-level="street"]'));
|
|
await wait(() => document.querySelector('.city-undefined-page-label'));
|
|
checkLabels('.city-generated-street-label,.city-undefined-page-label');
|
|
toggleLabels(false);
|
|
if (getComputedStyle(document.querySelector('.city-undefined-page-label')).display !== 'none')
|
|
throw new Error('Labels toggle does not hide undefined Pages');
|
|
toggleLabels(true);
|
|
activate(document.querySelector('[data-city-level="quartier"]'));
|
|
await wait(() => document.querySelectorAll('.city-generated-street-label').length === 2);
|
|
activate(document.querySelectorAll('.city-street-tile')[1]);
|
|
await wait(() => document.querySelector('.city-spot-point-label'));
|
|
checkLabels('.city-generated-street-label,.city-spot-point-label');
|
|
activate(document.querySelector('[data-city-level="quartier"]'));
|
|
await wait(() => document.querySelectorAll('.city-generated-street-label').length === 2);
|
|
checkLabels('.city-generated-street-label');
|
|
document.body.dataset.vimReady = 'true';
|
|
} catch (error) {
|
|
const box = document.createElement('div');
|
|
box.id = 'error'; box.textContent = error.message; document.body.append(box);
|
|
}
|
|
});
|