Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
feat(enquete): fix type secretaire_specialise_etp #1801 #1811
Browse files Browse the repository at this point in the history
  • Loading branch information
Toub committed May 25, 2020
1 parent f15e70d commit f3449df
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
"@babel/core": "^7.9.6",
"@babel/node": "^7.8.7",
"@socialgouv/eslint-config-react": "^0.21.0",
"@types/node": "^12.12.42",
"@testing-library/dom": "^7.5.7",
"@testing-library/jest-dom": "^5.8.0",
"@testing-library/react": "^10.0.4",
"@testing-library/user-event": "^10.3.5",
"@types/node": "^12.12.42",
"@types/react": "^16.9.35",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^1.10.7",
Expand All @@ -102,4 +102,4 @@
"style-loader": "^0.23.1",
"webpack": "^4.43.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const CREATE_ENQUETE_INDIVIDUEL = gql`
$mandataireId: Int!
$estimationEtp: String
$secretaireSpecialise: Boolean
$secretaireSpecialiseEtp: String
$secretaireSpecialiseEtp: Float
$cumulPrepose: Boolean
$cumulPreposeEtp: String
$cumulDelegueService: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ export const EnqueteIndividuelInformations = props => {
estimation_etp: values.estimation_etp || null,
forme_juridique: values.forme_juridique ? values.forme_juridique : null,
local_professionnel: values.local_professionnel,
secretaire_specialise_etp: values.secretaire_specialise_etp
? `${values.secretaire_specialise_etp}`
: null
secretaire_specialise_etp:
values.secretaire_specialise_etp &&
!isNaN(parseFloat(values.secretaire_specialise_etp))
? parseFloat(values.secretaire_specialise_etp)
: null
}
});
await goToNextPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const EnqueteIndividuelInformationsForm = props => {

const { handleSubmit, handleChange, values, errors, setFieldValue } = useFormik({
onSubmit: async (values, { setSubmitting }) => {
console.log("xxx values:", values);
await props.handleSubmit(values);
setSubmitting(false);
},
Expand Down Expand Up @@ -157,7 +158,7 @@ export const EnqueteIndividuelInformationsForm = props => {
<Field>
<Label mb={1}>{"Exercez-vous votre activité dans un local professionnnel ?"}</Label>
<YesNoComboBox
defaultValue={"local_professionnel"}
defaultValue={values.local_professionnel}
name="local_professionnel"
onChange={value => setFieldValue("local_professionnel", value)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test("it should display initial values", () => {
estimation_etp: INTERVALLE_ETP_OPTIONS[1].value,
forme_juridique: "SASU",
local_professionnel: true,
secretaire_specialise_etp: "5"
secretaire_specialise_etp: 5
};

const { getByLabelText } = render(
Expand All @@ -35,7 +35,7 @@ test("it should display initial values", () => {
const secretaireSpecialiseEtp = getByLabelText(
/Estimation de l'activité en ETP du secrétariat spécialisé/i
);
expect(secretaireSpecialiseEtp.value).toEqual("5");
expect(secretaireSpecialiseEtp.value).toEqual(5);
});

test('it should display "forme juridique" field when "benevole" field is not selected', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const UPDATE_ENQUETE_INDIVIDUEL_INFORMATIONS = gql`
$estimation_etp: String
$forme_juridique: String
$local_professionnel: Boolean
$secretaire_specialise_etp: String
$secretaire_specialise_etp: Float
$sexe: String
) {
update_enquete_reponses_informations_mandataire_by_pk(
Expand Down

0 comments on commit f3449df

Please sign in to comment.