Chart builder: drop unparseable expressions mid-edit, polite glyphed inline feedback

This commit is contained in:
2026-06-11 16:08:03 +03:00
parent 05df0cd7d3
commit d666599a58
9 changed files with 157 additions and 24 deletions
@@ -256,8 +256,15 @@ describe('ChartBuilderModal', () => {
await Promise.resolve();
});
const alert = container.querySelector('[role="alert"]');
expect(alert?.textContent).toMatch(/nexpected|Invalid/);
// Polite, not assertive: live per-keystroke validation uses role="status" with a
// status glyph, never an assertive alert (council: APG Alert / WCAG 2.2.4).
const messages = Array.from(container.querySelectorAll('[role="status"]'));
const errorMsg = messages.find((n) => /nexpected|Invalid/.test(n.textContent ?? ''));
expect(errorMsg).toBeTruthy();
// The expression input is linked to its message and flagged invalid.
const exprInput = container.querySelector('input[aria-label="Filter expression"]');
expect(exprInput?.getAttribute('aria-invalid')).toBe('true');
expect(exprInput?.getAttribute('aria-describedby')).toBe(errorMsg?.id);
});
test('the Vega expression reference shows only when an expression is in play (1E)', async () => {