Merge pull request #140 from fsolla/cursor/pool-i130-c5143bec-1fbc

B103 — Remover título Sugestões no empty state da busca
This commit is contained in:
Francisco Solla 2026-08-01 15:24:21 -03:00 committed by GitHub
commit 1c2f767d96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 1 deletions

View file

@ -26,10 +26,11 @@ export const HomeSearchMunicipalityGroup = () => {
if (visibleMunicipalities.length === 0 && visibleTerritories.length === 0) return null
const sectionTitle = resultKind === 'suggest' ? 'Sugestões' : 'Municípios'
const showHeading = resultKind !== 'suggest'
return (
<section aria-label={sectionTitle} className="flex flex-col gap-0.5">
<h2 className={HOME_SEARCH_GROUP_HEADING_CLASS}>{sectionTitle}</h2>
{showHeading ? <h2 className={HOME_SEARCH_GROUP_HEADING_CLASS}>{sectionTitle}</h2> : null}
<ul className={HOME_SEARCH_GROUP_LIST_CLASS}>
{visibleMunicipalities.map((hit) => (
<li key={`municipality-${hit.slug}`}>

View file

@ -55,6 +55,34 @@ describe('HomeSearchHitRow', () => {
})
describe('HomeSearchMunicipalityGroup', () => {
it('omits the visible heading in suggest mode while keeping an accessible section name', () => {
render(
<HomeSearchResultsProvider
value={searchResultsValue(
{
municipalities: [
{
kind: 'municipality',
slug: 'cairu',
name: 'Cairu',
region: 'Recôncavo',
priority: null,
votePosition2022: null,
},
],
},
'suggest',
)}
>
<HomeSearchMunicipalityGroup />
</HomeSearchResultsProvider>,
)
expect(screen.queryByRole('heading', { name: 'Sugestões' })).toBeNull()
expect(screen.getByRole('region', { name: 'Sugestões' })).toBeTruthy()
expect(screen.getByRole('link', { name: /Cairu/i })).toBeTruthy()
})
it('renders a discreet sentence-case heading and list without bullets', () => {
const { container } = render(
<HomeSearchResultsProvider