From 430e72faff78d83953f2685fa5458a1cfb1d6134 Mon Sep 17 00:00:00 2001 From: Alexandre Monjol Date: Wed, 27 Sep 2023 20:51:43 +0200 Subject: [PATCH] bug(email) prevent uppercase value on any email field --- src/components/customers/AddCustomerDrawer.tsx | 1 + src/components/form/TextInput/TextInput.tsx | 5 +++++ .../form/TextInput/__tests__/FormatValue.test.ts | 10 ++++++++++ .../settings/EditOrganizationInformationsDialog.tsx | 1 + src/components/settings/members/CreateInviteDialog.tsx | 1 + src/pages/Invitation.tsx | 1 + src/pages/auth/ForgotPassword.tsx | 1 + src/pages/auth/Login.tsx | 1 + src/pages/auth/ResetPassword.tsx | 1 + src/pages/auth/SignUp.tsx | 1 + 10 files changed, 23 insertions(+) diff --git a/src/components/customers/AddCustomerDrawer.tsx b/src/components/customers/AddCustomerDrawer.tsx index 3726422ae..b3f3ee326 100644 --- a/src/components/customers/AddCustomerDrawer.tsx +++ b/src/components/customers/AddCustomerDrawer.tsx @@ -312,6 +312,7 @@ export const AddCustomerDrawer = forwardRef((_, ref) => { /> { expect(number).toBe('938884') }) + it('should return a lowercase string for "lowercase" formatter', () => { + const lowercase = formatValue('May the Force be with you', 'lowercase') + const uppercase = formatValue('MY PRECIOUS.', 'lowercase') + const number = formatValue(938884, 'lowercase') + + expect(lowercase).toBe('may the force be with you') + expect(uppercase).toBe('my precious.') + expect(number).toBe('938884') + }) + it('should return the right value for combined formatters', () => { const decimalPositive = formatValue(-13.459484, ['decimal', 'positiveNumber']) const intPositive = formatValue(-11.459484, ['int', 'positiveNumber']) diff --git a/src/components/settings/EditOrganizationInformationsDialog.tsx b/src/components/settings/EditOrganizationInformationsDialog.tsx index 942bf4e94..81194f944 100644 --- a/src/components/settings/EditOrganizationInformationsDialog.tsx +++ b/src/components/settings/EditOrganizationInformationsDialog.tsx @@ -167,6 +167,7 @@ export const EditOrganizationInformationsDialog = forwardRef< ((_, ref) => { {!inviteToken ? ( { diff --git a/src/pages/auth/ForgotPassword.tsx b/src/pages/auth/ForgotPassword.tsx index 97cd30044..217a95a27 100644 --- a/src/pages/auth/ForgotPassword.tsx +++ b/src/pages/auth/ForgotPassword.tsx @@ -90,6 +90,7 @@ const ForgotPassword = () => {
e.preventDefault()}> { { diff --git a/src/pages/auth/SignUp.tsx b/src/pages/auth/SignUp.tsx index 5605cc38c..b579ae151 100644 --- a/src/pages/auth/SignUp.tsx +++ b/src/pages/auth/SignUp.tsx @@ -134,6 +134,7 @@ const SignUp = () => { /> setFormFields((prev) => ({ ...prev, email: value }))} label={translate('text_62a99ba2af7535cefacab4aa')} placeholder={translate('text_62a99ba2af7535cefacab4bf')}