mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
Replace layout/spacing utility string assertions with stable contract pins (data-slot, data-retracted, exported constant identity, ARIA). Delete cosmetic-only padding/bleed/grid pins per plan remover-pins-classname. Closes #240 Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import { HomeSearchResultsProvider } from '@/components/campaign/dashboard/HomeSearchResultsContext'
|
|
import { HomeSearchResultsLayout } from '@/components/campaign/dashboard/HomeSearchResultsLayout'
|
|
import type { HomeSearchSuccessResponse } from '@/lib/campaignHomeSearchHits'
|
|
|
|
const searchResultsValue = (
|
|
data: Partial<HomeSearchSuccessResponse> = {},
|
|
resultKind: HomeSearchSuccessResponse['resultKind'] = 'search',
|
|
) => ({
|
|
results: {
|
|
status: 'success' as const,
|
|
data: {
|
|
status: 'success' as const,
|
|
resultKind,
|
|
municipalities: [],
|
|
territories: [],
|
|
advisors: [],
|
|
leaderships: [],
|
|
stateDeputies: [],
|
|
activities: [],
|
|
demands: [],
|
|
...data,
|
|
},
|
|
},
|
|
isFetching: false,
|
|
resultKind,
|
|
})
|
|
|
|
describe('HomeSearchResultsLayout', () => {
|
|
it('renders a responsive grid container for result groups', () => {
|
|
const { container } = render(
|
|
<HomeSearchResultsProvider value={searchResultsValue()}>
|
|
<HomeSearchResultsLayout>
|
|
<p>Group A</p>
|
|
<p>Group B</p>
|
|
</HomeSearchResultsLayout>
|
|
</HomeSearchResultsProvider>,
|
|
)
|
|
|
|
const layout = container.querySelector('[data-slot="home-search-results-layout"]')
|
|
expect(layout).not.toBeNull()
|
|
expect(screen.getByText('Group A')).toBeTruthy()
|
|
expect(screen.getByText('Group B')).toBeTruthy()
|
|
})
|
|
})
|