Skip to content

Commit

Permalink
test: re-enabling and fixing the tests for PhoneInput (#183)
Browse files Browse the repository at this point in the history
Author: @lloydaf
  • Loading branch information
lloydaf authored Oct 18, 2021
1 parent cfcf138 commit 14cf21b
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit 14cf21b

Please sign in to comment.