test(journey-add-bar): add red test — confirm button must be natively disabled (WCAG 4.1.2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-09 17:52:47 +02:00
parent 55989058a5
commit e1ca2c6831

View File

@@ -9,23 +9,23 @@ afterEach(() => {
});
describe('JourneyAddBar — interlude flow', () => {
it('interlude confirm button is aria-disabled until text is non-empty', async () => {
it('interlude confirm button is natively disabled when text is empty (WCAG 4.1.2)', async () => {
render(JourneyAddBar, { onAddDocument: vi.fn(), onAddInterlude: vi.fn() });
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true });
await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'true');
await expect.element(confirmBtn).toBeDisabled();
});
it('confirm becomes active after typing text', async () => {
it('confirm becomes enabled after typing text', async () => {
render(JourneyAddBar, { onAddDocument: vi.fn(), onAddInterlude: vi.fn() });
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
await userEvent.fill(page.getByRole('textbox'), 'Eine schöne Reise');
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true });
await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'false');
await expect.element(confirmBtn).toBeEnabled();
});
it('calls onAddInterlude with text on confirm', async () => {