-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VACMS-19386 Update contact info component (#821)
- Loading branch information
Showing
10 changed files
with
107 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,6 @@ declare namespace JSX { | |
'va-link' | ||
'va-link-action' | ||
'va-on-this-page' | ||
'va-telephone' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import { fireEvent, getByRole } from '@testing-library/dom' | ||
jest.mock('@/lib/analytics/recordEvent') | ||
import * as recordEvent from '@/lib/analytics/recordEvent' | ||
import { ContactInfo } from './index' | ||
import { ParagraphComponent } from '@/types/formatted/paragraph' | ||
import { ContactInfo as FormattedContactInfo } from '@/types/formatted/contactInfo' | ||
|
@@ -11,8 +9,8 @@ describe('ContactInfo with valid data', () => { | |
id: '1', | ||
contactType: 'DC', | ||
defaultContact: { | ||
title: 'Phone Number', | ||
value: '(855) 867-5309', | ||
label: 'Phone Number', | ||
number: '(855) 867-5309', | ||
href: 'tel:8558675309', | ||
}, | ||
} | ||
|
@@ -45,50 +43,39 @@ describe('ContactInfo with valid data', () => { | |
contactType: 'BHC', | ||
benefitHubContacts: [ | ||
{ | ||
title: 'Health benefits hotline: ', | ||
value: '877-222-VETS (8387)', | ||
label: 'Health benefits hotline: ', | ||
number: '877-222-VETS (8387)', | ||
href: 'tel:8772228387', | ||
}, | ||
{ | ||
title: 'My HealtheVet help desk: ', | ||
value: '877-327-0022', | ||
label: 'My HealtheVet help desk: ', | ||
number: '877-327-0022', | ||
href: 'tel:8773270022', | ||
}, | ||
{ | ||
title: 'eBenefits technical support:', | ||
value: '800-983-0937', | ||
label: 'eBenefits technical support:', | ||
number: '800-983-0937', | ||
href: 'tel:8009830937', | ||
}, | ||
{ | ||
title: 'MyVA411 main information line:', | ||
value: '800-698-2411', | ||
label: 'MyVA411 main information line:', | ||
number: '800-698-2411', | ||
href: 'tel:8006982411', | ||
}, | ||
{ | ||
title: 'Telecommunications Relay Services (using TTY)', | ||
value: 'TTY: 711', | ||
label: 'Telecommunications Relay Services (using TTY)', | ||
number: 'TTY: 711', | ||
href: 'tel:1+711', | ||
}, | ||
], | ||
} | ||
|
||
render(<ContactInfo {...bhc} />) | ||
const { container } = render(<ContactInfo {...bhc} />) | ||
|
||
expect(screen.queryByText(/Phone Number/)).not.toBeInTheDocument() | ||
expect(screen.queryByText(/My HealtheVet help desk/)).toBeInTheDocument() | ||
}) | ||
|
||
test('click event sends correct params to recordEvent', () => { | ||
data.defaultContact.value = '[email protected]' | ||
const { container } = render(<ContactInfo {...data} />) | ||
const link = getByRole(container, 'link') | ||
|
||
fireEvent.click(link) | ||
expect(recordEvent.recordEvent).toHaveBeenCalledWith({ | ||
event: 'nav-linkslist', | ||
'links-list-header': 't%24st.vet%3Dran%40va.gov', | ||
'links-list-section-header': 'Need more help?', | ||
}) | ||
jest.restoreAllMocks() | ||
expect(container.innerHTML).toContain( | ||
'<va-telephone contact="800-983-0937">' | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,12 +58,9 @@ describe('<ResourcesSupport /> Component', () => { | |
type: 'paragraph--contact_information' as ContactInfo['type'], | ||
contactType: 'DC' as ContactInfo['contactType'], | ||
defaultContact: { | ||
name: 'Test Name', | ||
phone: '123-456-7890', | ||
email: '[email protected]', | ||
title: 'Test contact title', | ||
value: 'Test Value', | ||
href: '/test-contact-href/', | ||
href: 'tel:1-800-698-2411', | ||
label: 'MyVA411 main information line:', | ||
number: '800-698-2411', | ||
}, | ||
}, | ||
benefitsHubLinks: [ | ||
|
@@ -102,6 +99,6 @@ describe('<ResourcesSupport /> Component', () => { | |
expect(screen.getByText('If you need support...')).toBeInTheDocument() | ||
expect(screen.getByText('Test Audience')).toBeInTheDocument() | ||
expect(screen.getByText('Test Topic')).toBeInTheDocument() | ||
expect(screen.getByText('Test contact title')).toBeInTheDocument() | ||
expect(screen.getByText('Need more help?')).toBeInTheDocument() | ||
}) | ||
}) |
Oops, something went wrong.