diff --git a/__tests__/unit/a11y-nomes-acessiveis.test.ts b/__tests__/unit/a11y-nomes-acessiveis.test.ts new file mode 100644 index 0000000..1f43808 --- /dev/null +++ b/__tests__/unit/a11y-nomes-acessiveis.test.ts @@ -0,0 +1,38 @@ +import { describe, it, expect } from 'vitest' +import { readFileSync } from 'node:fs' +import { join } from 'node:path' + +// ─── Botões só de ícone sem nome acessível (#106) ────────────────────────── +// +// Não há infra de render de componente no projeto (sem jsdom/testing-library). +// O gate possível é sobre o texto-fonte, padrão já usado em row-actions.test.ts +// (#54) e a11y-estado-selecao.test.ts (#107). +// +// A asserção precisa ancorar no ) só existam depois dele. + const pattern = new RegExp( + `` + ) + return source.match(pattern)?.[0] +} + +describe('DeleteButton — gatilho de exclusão com nome acessível (#126)', () => { + const source = readFileSync(join(process.cwd(), 'components/ui/delete-button.tsx'), 'utf-8') + const trigger = findClosestButtonWithIcon(source, 'Trash2') + + it('encontra o bloco do botão gatilho (o mais próximo do ícone Trash2)', () => { + expect(trigger).toBeDefined() + }) + + it('expõe aria-label no