Skip to content

Commit

Permalink
Issue 669 va-link for google directions (#673)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Cosgrove <timcosgrove@users.noreply.github.com>
Co-authored-by: JR Reed <mikereed101@gmail.com>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 0b1925d commit 0a48482
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/templates/common/googleMapsDirections/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ describe('GoogleMapsDirections Component', () => {

render(<GoogleMapsDirections title={title} address={address} />)

const anchorElement = screen.getByRole('link', {
name: /get directions on google maps/i,
})
//leaving old elemet selector just in case we need to re-use it
// const anchorElement = screen.getByRole('va-link', {
// name: "maps-directions",
// })

const anchorElement = screen.getByTestId('maps-directions')
expect(anchorElement).toBeInTheDocument()

expect(anchorElement).toHaveAttribute('href', expectedUrl)
})
})
14 changes: 8 additions & 6 deletions src/templates/common/googleMapsDirections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export const GoogleMapsDirections = ({ title, address }) => {
)}`

return (
<div>
<a href={googleMapsUrl}>
Get directions on Google Maps
<span className="sr-only">to {title}</span>
</a>
</div>
<va-link
class="vads-u-display--block vads-u-margin-top--0"
href={googleMapsUrl}
name="maps-directions"
id="google-map-directions"
text={`Get directions on Google Maps`}
data-testid="maps-directions"
></va-link>
)
}

0 comments on commit 0a48482

Please sign in to comment.