import { render, screen } from '@testing-library/react' import { describe, expect, it, vi } from 'vitest' import { CampaignHomeLayout } from '@/components/campaign/dashboard/CampaignHomeLayout' 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('CampaignHomeLayout focused mode', () => { it('hides actions, thumb spacer, and summary when focused', () => { const { container } = render( Actions block

} searchSlot={

Search

} summarySlot={

Summary block

} />, ) expect(container.querySelector('[data-slot="home-thumb-spacer"]')).toBeNull() expect(container.querySelector('[data-slot="home-actions"]')?.className).toContain('hidden') expect(container.querySelector('[data-slot="home-summary"]')?.className).toContain('hidden') }) it('shows summary when not focused', () => { render( Actions block

} summarySlot={

Summary stub

} />, ) expect( screen.getByTestId('home-summary-stub').closest('[data-slot="home-summary"]'), ).not.toBeNull() }) }) describe('CampaignHomeSearch', () => { it('renders search input and results region', () => { render(

Group stub

, ) expect(screen.getByLabelText('Buscar na campanha')).toBeTruthy() expect(screen.getByRole('region', { name: 'Resultados da busca' })).toBeTruthy() expect(screen.getByText('Group stub')).toBeTruthy() }) })