Skip to content

Commit

Permalink
actually change the button href (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshreisner authored Oct 1, 2024
1 parent 14ee28d commit 70f8db2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Meeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default function Meeting({
});
if (meeting[`contact_${i}_phone` as keyof typeof Meeting])
contactButtons.push({
href: `tel:${meeting[`contact_${i}_phone` as keyof typeof Meeting]}`,
href: `sms:${meeting[`contact_${i}_phone` as keyof typeof Meeting]}`,
icon: 'text',
text: i18n(strings.contact_text, {
contact: meeting[`contact_${i}_name` as keyof typeof Meeting],
Expand Down
30 changes: 30 additions & 0 deletions test/__tests__/Meeting.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ describe('<Meeting />', () => {
conference_phone_notes: 'Test',
conference_provider: 'Zoom',
updated: '2/17/22',
contact_1_name: 'Contact 1',
contact_1_email: '[email protected]',
contact_1_phone: '+18005551212',
contact_2_email: '[email protected]',
contact_2_phone: '+18005551212',
};

const mockState: State = {
Expand Down Expand Up @@ -140,6 +145,31 @@ describe('<Meeting />', () => {
expect(container).toBeTruthy();
});

it('renders with contact 1 but no contact 2', () => {
const { getByText, queryByText } = render(
<MemoryRouter>
<Meeting
state={mockState}
setState={jest.fn()}
mapbox="pk.123456"
feedback_emails={['[email protected]']}
/>
</MemoryRouter>
);
const contact1text = getByText(`Text ${mockMeeting.contact_1_name}`);
expect(contact1text).toHaveAttribute(
'href',
`sms:${mockMeeting.contact_1_phone}`
);
const contact1email = getByText(`Email ${mockMeeting.contact_1_name}`);
expect(contact1email).toHaveAttribute(
'href',
`mailto:${mockMeeting.contact_1_email}`
);
const contact2text = queryByText(`Text ${mockMeeting.contact_2_name}`);
expect(contact2text).toBeNull();
});

it('renders when inactive', () => {
const { container } = render(
<MemoryRouter>
Expand Down

0 comments on commit 70f8db2

Please sign in to comment.