mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
fix: show only the app's own message for a wrong address in the contact form, without the browser bubble over it
This commit is contained in:
@@ -50,6 +50,22 @@ describe('ContactForm', () => {
|
||||
expect(onSave).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// The browser's own "Please include an '@'" bubble sat over the app's
|
||||
// inline message: the form leaves checking to the app.
|
||||
it('says an address is wrong itself, with no browser bubble in the way', async () => {
|
||||
const onSave = vi.fn();
|
||||
render(<ContactForm contact={existingContact} onSave={onSave} onCancel={vi.fn()} />);
|
||||
const form = screen.getByText('save').closest('form')!;
|
||||
expect(form.noValidate).toBe(true);
|
||||
|
||||
fireEvent.change(screen.getByDisplayValue('alice@example.com'), { target: { value: 'alice@' } });
|
||||
// A click on Save, as the user does: the browser checks a form that
|
||||
// has no noValidate before it lets the submit through.
|
||||
fireEvent.click(screen.getByRole('button', { name: 'save' }));
|
||||
expect(await screen.findByText('email_invalid')).toBeInTheDocument();
|
||||
expect(onSave).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('adds email entry when add button is clicked', () => {
|
||||
render(<ContactForm onSave={vi.fn()} onCancel={vi.fn()} />);
|
||||
const emailInputsBefore = screen.getAllByPlaceholderText('email_placeholder');
|
||||
|
||||
@@ -693,7 +693,9 @@ export function ContactForm({ contact, addressBooks, allKeywords, defaultAddress
|
||||
const previewEmail = emails.find(e => e.address.trim())?.address.trim() || "";
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="flex flex-col h-full bg-background">
|
||||
// The app checks the fields itself and says what is wrong inline; the
|
||||
// browser's own bubble covered that message.
|
||||
<form onSubmit={handleSubmit} noValidate className="flex flex-col h-full bg-background">
|
||||
<div className="flex items-center justify-between px-6 py-4 border-b border-border flex-shrink-0">
|
||||
<h2 className="text-lg font-semibold">
|
||||
{isEditing ? t("edit_title") : t("create_title")}
|
||||
|
||||
Reference in New Issue
Block a user