Skip to content

Commit

Permalink
feat: add international option to Phone
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasjay committed Mar 1, 2024
1 parent e6815db commit 84aef3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Questions/Phone/__tests__/phone.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,15 @@ test('pattern error is displayed', () => {

expect(screen.getByText('This is not the right pattern'))
})

test('country code is visible', () => {
const result = render(
<QuestionPhone
question={{ ...question, defaultCountry: 'GB', international: true }}
useForm={formMethods}
/>
)
expect(
result.container.querySelector('input[type="tel"]').getAttribute('value')
).toBe('+44')
})
1 change: 1 addition & 0 deletions src/Questions/Phone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const QuestionPhone = ({ isMobile, isoCode, question, useForm, ...props }) => {
placeholder={question.placeholder}
registerConfig={question.registerConfig}
name={question.name}
international={question.international}
{...props}
/>

Expand Down

0 comments on commit 84aef3e

Please sign in to comment.