mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-22 22:23:07 +00:00
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:
commit
1c2f767d96
2 changed files with 30 additions and 1 deletions
|
|
@ -26,10 +26,11 @@ export const HomeSearchMunicipalityGroup = () => {
|
||||||
if (visibleMunicipalities.length === 0 && visibleTerritories.length === 0) return null
|
if (visibleMunicipalities.length === 0 && visibleTerritories.length === 0) return null
|
||||||
|
|
||||||
const sectionTitle = resultKind === 'suggest' ? 'Sugestões' : 'Municípios'
|
const sectionTitle = resultKind === 'suggest' ? 'Sugestões' : 'Municípios'
|
||||||
|
const showHeading = resultKind !== 'suggest'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section aria-label={sectionTitle} className="flex flex-col gap-0.5">
|
<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}>
|
<ul className={HOME_SEARCH_GROUP_LIST_CLASS}>
|
||||||
{visibleMunicipalities.map((hit) => (
|
{visibleMunicipalities.map((hit) => (
|
||||||
<li key={`municipality-${hit.slug}`}>
|
<li key={`municipality-${hit.slug}`}>
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,34 @@ describe('HomeSearchHitRow', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('HomeSearchMunicipalityGroup', () => {
|
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', () => {
|
it('renders a discreet sentence-case heading and list without bullets', () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<HomeSearchResultsProvider
|
<HomeSearchResultsProvider
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue