diff --git a/app/javascript/packages/address-search/components/full-address-search.spec.tsx b/app/javascript/packages/address-search/components/full-address-search.spec.tsx index f8a663bcb71..91c3cbcd2d4 100644 --- a/app/javascript/packages/address-search/components/full-address-search.spec.tsx +++ b/app/javascript/packages/address-search/components/full-address-search.spec.tsx @@ -66,6 +66,51 @@ describe('FullAddressSearch', () => { }); }); + context('Address Search Label Text', () => { + it('does not render when handleLocationSelect is not null', async () => { + const handleLocationsFound = sandbox.stub(); + const onSelect = sinon.stub(); + const { queryByText } = render( + new Map() }}> + undefined} + handleLocationSelect={onSelect} + disabled={false} + /> + , + ); + + const searchLabel = await queryByText( + 'in_person_proofing.headings.po_search.address_search_label', + ); + expect(searchLabel).to.be.empty; + }); + + it('renders when handleLocationSelect is null', async () => { + const handleLocationsFound = sandbox.stub(); + const { queryByText } = render( + new Map() }}> + undefined} + handleLocationSelect={null} + disabled={false} + /> + , + ); + + const searchLabel = await queryByText( + 'in_person_proofing.body.location.po_search.address_search_label', + ); + expect(searchLabel).to.exist(); + }); + }); + context('validates form', () => { it('displays an error for all required fields when input is empty', async () => { const handleLocationsFound = sandbox.stub(); diff --git a/app/javascript/packages/address-search/components/full-address-search.tsx b/app/javascript/packages/address-search/components/full-address-search.tsx index f21f05fcd80..ab2dc67b402 100644 --- a/app/javascript/packages/address-search/components/full-address-search.tsx +++ b/app/javascript/packages/address-search/components/full-address-search.tsx @@ -30,11 +30,13 @@ function FullAddressSearch({ {t('idv.failure.exceptions.post_office_search_error')} )} - {handleLocationSelect && ( + {handleLocationSelect ? ( <> {t('in_person_proofing.headings.po_search.location')}

{t('in_person_proofing.body.location.po_search.po_search_about')}

+ ) : ( +

{t('in_person_proofing.body.location.po_search.address_search_label')}

)}