diff --git a/src/components/CountrySelector/CountrySelectorDropdown.tsx b/src/components/CountrySelector/CountrySelectorDropdown.tsx index 6312a9f..f76f4b5 100644 --- a/src/components/CountrySelector/CountrySelectorDropdown.tsx +++ b/src/components/CountrySelector/CountrySelectorDropdown.tsx @@ -1,6 +1,12 @@ import './CountrySelectorDropdown.style.scss'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import React, { + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from 'react'; import { defaultCountries } from '../../data/countryData'; import { buildClassNames } from '../../style/buildClassNames'; @@ -108,7 +114,9 @@ export const CountrySelectorDropdown: React.FC< const getCountryIndex = useCallback( (country: CountryIso2) => { - return orderedCountries.findIndex((c) => parseCountry(c).iso2 === country); + return orderedCountries.findIndex( + (c) => parseCountry(c).iso2 === country, + ); }, [orderedCountries], ); @@ -200,7 +208,9 @@ export const CountrySelectorDropdown: React.FC< const scrollToFocusedCountry = useCallback(() => { if (!listRef.current || focusedItemIndex === undefined) return; - const focusedCountry = parseCountry(orderedCountries[focusedItemIndex]).iso2; + const focusedCountry = parseCountry( + orderedCountries[focusedItemIndex], + ).iso2; if (focusedCountry === lastScrolledCountry.current) return; const element = listRef.current.querySelector( @@ -268,7 +278,8 @@ export const CountrySelectorDropdown: React.FC< className={buildClassNames({ addPrefix: [ 'country-selector-dropdown__list-item', - preferredCountrySet.has(country.iso2) && 'country-selector-dropdown__list-item--preferred', + preferredCountrySet.has(country.iso2) && + 'country-selector-dropdown__list-item--preferred', isSelected && 'country-selector-dropdown__list-item--selected', isFocused && 'country-selector-dropdown__list-item--focused', ], diff --git a/src/components/PhoneInput/PhoneInput.test.tsx b/src/components/PhoneInput/PhoneInput.test.tsx index a6598f7..f90813b 100644 --- a/src/components/PhoneInput/PhoneInput.test.tsx +++ b/src/components/PhoneInput/PhoneInput.test.tsx @@ -900,24 +900,22 @@ describe('PhoneInput', () => { describe('preferred countries', () => { test('should display preferred countries on top', () => { - render( - , - ); + render(); - expect(getCountrySelectorDropdown().childNodes[0]).toBe(getDropdownOption('us')); - expect(getCountrySelectorDropdown().childNodes[1]).toBe(getDropdownOption('gb')); + expect(getCountrySelectorDropdown().childNodes[0]).toBe( + getDropdownOption('us'), + ); + expect(getCountrySelectorDropdown().childNodes[1]).toBe( + getDropdownOption('gb'), + ); }); test('should ignore invalid preferred countries', () => { - render( - , - ); + render(); - expect(getCountrySelectorDropdown().childNodes[0]).toBe(getDropdownOption('us')); + expect(getCountrySelectorDropdown().childNodes[0]).toBe( + getDropdownOption('us'), + ); }); });