fix(FormField): resolve minor accessibility and rendering issues (#4515)

Co-authored-by: Romain Hamel <rom.hml@gmail.com>
This commit is contained in:
Thilo Hettmer
2025-07-16 21:55:57 +02:00
committed by GitHub
parent 8b42365bf4
commit c64c4cdea0
7 changed files with 80 additions and 55 deletions

View File

@@ -157,5 +157,25 @@ describe('FormField', () => {
const attr = wrapper.find('[aria-invalid=true]')
expect(attr.exists()).toBe(true)
})
test('renders id for aria describedby when help prop is provided', async () => {
const wrapper = await renderFormField({
props: { help: 'somehelp' },
inputComponent
})
const attr = wrapper.find('[id=v-0-0-help]')
expect(attr.exists()).toBe(true)
})
test('renders no id for aria describedby when no help prop is provided', async () => {
const wrapper = await renderFormField({
props: { label: 'Username', description: 'Enter your username' },
inputComponent
})
const attr = wrapper.find('[id=v-0-0-help]')
expect(attr.exists()).toBe(false)
})
})
})