teqo-backup/tests/unit/campaignHomeSearch.unit.spec.tsx
Francisco Ignácio Fontoura Solla 31bd488c1e B66: retract home chrome on search focus with animated transition.
Emends B47 so focusing the input clears strip/summary before typing; hardens hit rows against blur-before-click.
2026-07-30 01:21:37 -03:00

31 lines
994 B
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, expect, it, vi } from 'vitest'
import { CampaignHomeSearch } from '@/components/campaign/dashboard/CampaignHomeSearch'
import { HomeSearchProvider } from '@/components/campaign/dashboard/HomeSearchContext'
const providerValue = {
query: { raw: 'ca', debounced: 'ca', isActive: true },
setRaw: vi.fn(),
clear: vi.fn(),
isDebouncing: false,
inputFocused: false,
setInputFocused: vi.fn(),
uiFocused: true,
}
describe('CampaignHomeSearch', () => {
it('renders search input and results region', () => {
render(
<HomeSearchProvider value={providerValue}>
<CampaignHomeSearch>
<p>Group stub</p>
</CampaignHomeSearch>
</HomeSearchProvider>,
)
expect(screen.getByLabelText('Buscar na campanha')).toBeTruthy()
expect(screen.getByRole('region', { name: 'Resultados da busca' })).toBeTruthy()
expect(screen.getByText('Group stub')).toBeTruthy()
})
})