fix: pass correct arguments to setEmailSuggestionContext in handleSuggestionClick

The function expects two string arguments (suggestion, type) but was
being called with a single object, corrupting the email suggestion state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adolfo R. Brandes
2026-03-06 18:59:31 -03:00
committed by Adolfo R. Brandes
parent cb3ad5c53a
commit 3dbd6a76df
2 changed files with 5 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ const EmailField = (props) => {
handleErrorChange('email', '');
handleChange({ target: { name: 'email', value: emailSuggestion.suggestion } });
setEmailSuggestion({ suggestion: '', type: '' });
setEmailSuggestionContext({ suggestion: '', type: '' });
setEmailSuggestionContext('', '');
};
const handleSuggestionClosed = () => setEmailSuggestion({ suggestion: '', type: '' });

View File

@@ -182,6 +182,10 @@ describe('EmailField', () => {
expect(props.handleChange).toHaveBeenCalledWith(
{ target: { name: 'email', value: 'john@hotmail.com' } },
);
expect(mockRegisterContext.setEmailSuggestionContext).toHaveBeenCalledWith(
expect.any(String),
expect.any(String),
);
});
it('should give error for common top level domain mistakes', () => {