Add collapsible JSON tree to admin views
Build and publish frontend / publish (push) Successful in 54s

This commit is contained in:
Ein Anderssono
2026-10-24 03:29:54 +02:00
parent 4101be2447
commit 06dea70ed1
3 changed files with 206 additions and 66 deletions
+19 -10
View File
@@ -44,14 +44,23 @@ test('admin can switch to a storyteller-only reading view and return to diagnost
});
test('admin JSON responses use tab-indented syntax-colored accessible output', () => {
assert.match(page, /function appendFormattedJson/);
assert.match(page, /JSON\.stringify\(value, null, '\\t'\)/);
assert.match(page, /json-token-key/);
assert.match(page, /json-token-string/);
assert.match(page, /json-token-number/);
assert.match(page, /json-token-boolean/);
assert.match(page, /json-token-null/);
assert.match(page, /setAttribute\('aria-label', 'Formaterat JSON-svar'\)/);
assert.match(page, /appendFormattedJson\(pre, group\)/);
test('admin JSON responses are readable as accessible collapsible trees', () => {
assert.match(page, /function renderJsonTree/);
assert.match(page, /nested\.className = 'json-node'/);
assert.match(page, /const nodeValues = new WeakMap\(\)/);
assert.match(page, /nodeValues\.set\(nested, child\)/);
assert.match(page, /groupSummary/);
assert.match(page, /Lista · \$\{item\.length\}/);
assert.match(page, /Objekt · \$\{Object\.keys\(item\)\.length\} fält/);
assert.match(page, /Öppna alla block/);
assert.match(page, /Fäll ihop nästlade block/);
assert.match(page, /setAttribute\('aria-label', 'Utfällbart JSON-svar'\)/);
assert.match(page, /json-value-string/);
assert.match(page, /json-value-number/);
assert.match(page, /json-value-boolean/);
assert.match(page, /json-value-null/);
assert.match(page, /renderJsonTree\(json, group\)/);
assert.match(page, /rawSummary\.textContent = 'Visa hela spårdata'/);
assert.match(page, /JSON\.stringify\(npc\.profile, null, '\\t'\)/);
assert.doesNotMatch(page, /jsnview|cdn\.jsdelivr/);
});