Skip to content

fix: re-enabling and fixing the tests for PhoneInput, resolves #27 #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/PhoneInput/PhoneInput.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const selectOption = async (currentValueText: string, selectOptionText: string)
//
// I disabled the tests for now and created an issue to fix this see: https://github.com/freenowtech/wave/issues/27
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('PhoneInput', () => {
describe('PhoneInput', () => {
const defaultCountry = { value: 'DE', label: 'Germany', dialCode: '+49' };

it('should call the country change handler when the user selects a country', async () => {
Expand All @@ -35,7 +35,9 @@ describe.skip('PhoneInput', () => {
it('should focus on national number input after selecting a country', async () => {
render(<PhoneInput country={defaultCountry} label="Phone Number" />);

await selectOption(defaultCountry.dialCode, 'Spain (España) +34');
// not all the countries are rendered at one go, they are rendered as you scroll
// so select a country that will come at the top, for example Andorra
await selectOption(defaultCountry.dialCode, 'Andorra +376');

expect(document.activeElement).toEqual(screen.getByLabelText('Phone Number'));
});
Expand Down