diff --git a/src/components/PhoneInput/PhoneInput.test.tsx b/src/components/PhoneInput/PhoneInput.test.tsx
index 664c3e0..84144b6 100644
--- a/src/components/PhoneInput/PhoneInput.test.tsx
+++ b/src/components/PhoneInput/PhoneInput.test.tsx
@@ -1122,10 +1122,10 @@ describe('PhoneInput', () => {
test('should use default mask if country data does not have mask', () => {
// mask is undefined
- const { rerender } = render();
- fireChangeEvent('+1114567');
- expect(getInput().value).toBe('+1 114567');
- expect(getCountrySelector()).toHaveAttribute('data-country', 'do');
+ const { rerender } = render();
+ fireChangeEvent('+93114567');
+ expect(getInput().value).toBe('+93 114567');
+ expect(getCountrySelector()).toHaveAttribute('data-country', 'af');
// mask is empty string
rerender();
diff --git a/src/data/countryData.ts b/src/data/countryData.ts
index b97c604..2fb92f8 100644
--- a/src/data/countryData.ts
+++ b/src/data/countryData.ts
@@ -132,7 +132,7 @@ export const defaultCountries: CountryData[] = [
['Denmark', 'dk', '45', '.. .. .. ..'],
['Djibouti', 'dj', '253'],
['Dominica', 'dm', '1767'],
- ['Dominican Republic', 'do', '1', '', 2],
+ ['Dominican Republic', 'do', '1', '(...) ...-....', 2, ['809', '829', '849']],
['Ecuador', 'ec', '593'],
['Egypt', 'eg', '20'],
['El Salvador', 'sv', '503', '....-....'],
@@ -213,7 +213,21 @@ export const defaultCountries: CountryData[] = [
['Namibia', 'na', '264'],
['Nauru', 'nr', '674'],
['Nepal', 'np', '977'],
- ['Netherlands', 'nl', '31', '.. ........'],
+ [
+ 'Netherlands',
+ 'nl',
+ '31',
+ {
+ '/^06/': '(.). .........',
+ '/^6/': '. .........',
+ '/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/':
+ '(.).. ........',
+ '/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/':
+ '.. ........',
+ '/^0/': '(.)... .......',
+ default: '... .......',
+ },
+ ],
['New Caledonia', 'nc', '687'],
['New Zealand', 'nz', '64', '...-...-....'],
['Nicaragua', 'ni', '505'],
@@ -232,7 +246,7 @@ export const defaultCountries: CountryData[] = [
['Philippines', 'ph', '63', '.... .......'],
['Poland', 'pl', '48', '...-...-...'],
['Portugal', 'pt', '351'],
- ['Puerto Rico', 'pr', '1', '', 3, ['787', '939']],
+ ['Puerto Rico', 'pr', '1', '(...) ...-....', 3, ['787', '939']],
['Qatar', 'qa', '974'],
['RĂ©union', 're', '262'],
['Romania', 'ro', '40'],
diff --git a/src/utils/countryUtils/__tests__/guessCountryByPartialNumber.test.ts b/src/utils/countryUtils/__tests__/guessCountryByPartialNumber.test.ts
index 57202e9..44d5257 100644
--- a/src/utils/countryUtils/__tests__/guessCountryByPartialNumber.test.ts
+++ b/src/utils/countryUtils/__tests__/guessCountryByPartialNumber.test.ts
@@ -153,32 +153,22 @@ describe('guessCountryByPartialNumber', () => {
test('should return the current country if the dial code matches', () => {
expect(
guessCountryByPartialNumber({
- phone: '+1 234567890',
+ phone: '+39 1234567890',
countries: defaultCountries,
- currentCountryIso2: 'us',
+ currentCountryIso2: 'it',
}),
).toMatchObject({
- country: { dialCode: '1', iso2: 'us' },
+ country: { dialCode: '39', iso2: 'it' },
});
expect(
guessCountryByPartialNumber({
- phone: '+1 204567890', // Canada area code
+ phone: '+39 1234567890',
countries: defaultCountries,
- currentCountryIso2: 'do',
+ currentCountryIso2: 'va',
}),
).toMatchObject({
- country: { dialCode: '1', iso2: 'ca' },
- });
-
- expect(
- guessCountryByPartialNumber({
- phone: '+1 111567890',
- countries: defaultCountries,
- currentCountryIso2: 'do',
- }),
- ).toMatchObject({
- country: { dialCode: '1', iso2: 'do' },
+ country: { dialCode: '39', iso2: 'va' },
});
});
});