import { describe, expect, it } from 'vitest'
import { render } from '@testing-library/react'
import { Avatar } from './Avatar'
import { spokenPhraseUntil } from './sr-test-utils'

describe('Avatar [SR]', () => {
  it('announces the fallback/avatar accessible text when focused', async () => {
    render(<Avatar alt="Alex Doe" fallback="AD" />)
    const phrase = await spokenPhraseUntil(document.body, (value) => value.toLowerCase().includes('ad'))
    expect(phrase).toBeTruthy()
    expect(phrase.toLowerCase()).toContain('ad')
  })
})
