fix(contact): add standard autocomplete, inputmode and attributes for contact inputs
Deploy Canina / deploy (push) Successful in 2m10s
Deploy Canina / deploy (push) Successful in 2m10s
This commit is contained in:
1 parent
f9d70bc196
commit
b4fdd7abb8
2 files changed
+19
-1
No files matched your search
@@ -150,7 +150,9 @@ export default function ContactFormClient() {
|
|||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="contact-name"
|
id="contact-name"
|
||||||
|
name="name"
|
||||||
type="text"
|
type="text"
|
||||||
|
autoComplete="name"
|
||||||
value={name}
|
value={name}
|
||||||
onChange={(e) => setName(e.target.value)}
|
onChange={(e) => setName(e.target.value)}
|
||||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||||
@@ -162,7 +164,10 @@ export default function ContactFormClient() {
|
|||||||
<label htmlFor="contact-phone" className="text-xs font-black text-medical-gray-500">شماره موبایل *</label>
|
<label htmlFor="contact-phone" className="text-xs font-black text-medical-gray-500">شماره موبایل *</label>
|
||||||
<input
|
<input
|
||||||
id="contact-phone"
|
id="contact-phone"
|
||||||
type="text"
|
name="phone"
|
||||||
|
type="tel"
|
||||||
|
inputMode="tel"
|
||||||
|
autoComplete="tel"
|
||||||
value={phone}
|
value={phone}
|
||||||
onChange={(e) => setPhone(e.target.value)}
|
onChange={(e) => setPhone(e.target.value)}
|
||||||
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold text-left focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl p-4 text-sm font-bold text-left focus:outline-none focus:ring-2 focus:ring-canina-blue/20"
|
||||||
|
|||||||
@@ -131,4 +131,17 @@ describe("ContactFormClient Component", () => {
|
|||||||
expect(screen.getByText("خطا در سرور، لطفاً بعداً تلاش کنید.")).toBeInTheDocument();
|
expect(screen.getByText("خطا در سرور، لطفاً بعداً تلاش کنید.")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("provides standard autocomplete and inputmode attributes on contact inputs", () => {
|
||||||
|
vi.mocked(api.get).mockResolvedValueOnce({ data: [] });
|
||||||
|
render(<ContactFormClient />);
|
||||||
|
|
||||||
|
const nameInput = document.getElementById("contact-name");
|
||||||
|
const phoneInput = document.getElementById("contact-phone");
|
||||||
|
|
||||||
|
expect(nameInput).toHaveAttribute("autocomplete", "name");
|
||||||
|
expect(phoneInput).toHaveAttribute("autocomplete", "tel");
|
||||||
|
expect(phoneInput).toHaveAttribute("inputmode", "tel");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user