Skip to content

Commit

Permalink
[EN-6218] feat(messages): add newsletter checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
emile-bex committed Jul 12, 2023
1 parent 93c17c5 commit 2db7de3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion cypress/e2e/parcours-cv.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ describe('Parcours CV', () => {
.scrollIntoView()
.type('Random message');

cy.get('label[for="form-send-external-message-optIn"]')
cy.get('label[for="form-send-external-message-optInContact"]')
.scrollIntoView()
.click();

cy.get('label[for="form-send-external-message-optInNewsletter"]')
.scrollIntoView()
.click();

Expand Down
2 changes: 1 addition & 1 deletion src/components/cv/CVFiche.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const CVFiche = ({ cv, actionDisabled }) => {
} conseiller dans sa recherche d'emploi`}
submitText="Envoyer"
formSchema={formSendExternalMessage}
onSubmit={async ({ optIn, ...fields }, closeModal) => {
onSubmit={async (fields, closeModal) => {
gaEvent(GA_TAGS.PAGE_CV_ENVOYER_CONTACTEZ_MOI_CLIC);
fbEvent(FB_TAGS.MESSAGE_SEND);
try {
Expand Down
12 changes: 9 additions & 3 deletions src/components/forms/schema/formSendExternalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ export const formSendExternalMessage = {
title: 'Écrire votre message *',
},
{
id: 'optIn',
name: 'optIn',
id: 'optInContact',
name: 'optInContact',
component: 'checkbox-new',
title:
"En cochant cette case, vous acceptez qu'un membre de l'équipe vous recontacte *",
},
{
id: 'optInNewsletter',
name: 'optInNewsletter',
component: 'checkbox-new',
title: 'Je souhaite être tenu au courant des actualités du projet',
},
],
rules: [
{
Expand Down Expand Up @@ -151,7 +157,7 @@ export const formSendExternalMessage = {
message: 'Obligatoire',
},
{
field: 'optIn',
field: 'optInContact',
method: (fieldValue) => {
return !!fieldValue;
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/Inputs/CheckBox/CheckBox.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const StyledCheckbox = styled.div`
display: flex;
align-items: center;
justify-content: center;
justify-content: left;
height: 16px;
position: relative;
cursor: pointer;
Expand Down

0 comments on commit 2db7de3

Please sign in to comment.