fix: country field error is updated (#1108)

This commit is contained in:
Attiya Ishaque
2023-12-08 13:35:03 +05:00
committed by GitHub
parent 3a31cf33e2
commit dae050ecb3
7 changed files with 55 additions and 4 deletions

View File

@@ -285,6 +285,26 @@ describe('ConfigurableRegistrationForm', () => {
expect(registrationPage.find('div[feedback-for="country"]').text()).toEqual(countryError);
expect(registrationPage.find('#confirm_email-error').last().text()).toEqual(confirmEmailError);
});
it('should show country field validation when country name is invalid', () => {
const invalidCountryError = 'Country must match with an option available in the dropdown.';
store = mockStore({
...initialState,
commonComponents: {
...initialState.commonComponents,
fieldDescriptions: {
country: { name: 'country' },
},
},
});
const registrationPage = mount(routerWrapper(reduxWrapper(<IntlRegistrationPage {...props} />)));
registrationPage.find('input[name="country"]').simulate('blur', { target: { value: 'Pak', name: 'country' } });
registrationPage.find('button.btn-brand').simulate('click');
expect(registrationPage.find('div[feedback-for="country"]').text()).toEqual(invalidCountryError);
});
it('should show error if email and confirm email fields do not match', () => {
store = mockStore({
...initialState,