diff --git a/site/cypress/support/index.js b/site/cypress/support/index.js index 5cea4d3b6..9450c51ab 100644 --- a/site/cypress/support/index.js +++ b/site/cypress/support/index.js @@ -22,13 +22,13 @@ import './commands' const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/ Cypress.on('uncaught:exception', (err) => { - /* + /* The error 'ResizeObserver loop limit exceeded' is benigne Returning false here prevents Cypress from failing the test cf https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded */ - if (resizeObserverLoopErrRe.test(err.message)) { - return false - } + if (resizeObserverLoopErrRe.test(err.message)) { + return false + } }) diff --git a/site/source/components/conversation/RuleInput.tsx b/site/source/components/conversation/RuleInput.tsx index e7570c5f2..5fa7b87aa 100644 --- a/site/source/components/conversation/RuleInput.tsx +++ b/site/source/components/conversation/RuleInput.tsx @@ -12,7 +12,6 @@ import Engine, { reduceAST, RuleNode, } from 'publicodes' -import { isEmpty } from 'ramda' import React, { useContext } from 'react' import { Choice, MultipleAnswerInput, OuiNonInput } from './ChoicesInput' import DateInput from './DateInput' @@ -81,12 +80,13 @@ export default function RuleInput({ const rule = engine.getRule(dottedName) const evaluation = engine.evaluate({ valeur: dottedName, ...modifiers }) const value = evaluation.nodeValue + console.log(missing, evaluation.missingVariables) const commonProps: InputProps = { dottedName, value, missing: missing ?? - (!showDefaultDateValue && !isEmpty(evaluation.missingVariables)), + (!showDefaultDateValue && dottedName in evaluation.missingVariables), onChange: (value: PublicodesExpression | undefined) => onChange(value, dottedName), title: rule.title, diff --git a/site/source/pages/gerer/_components/Fields.tsx b/site/source/pages/gerer/_components/Fields.tsx index 0bdbb6dac..b74eeb719 100644 --- a/site/source/pages/gerer/_components/Fields.tsx +++ b/site/source/pages/gerer/_components/Fields.tsx @@ -16,6 +16,7 @@ import { evaluateQuestion, getMeta } from '@/utils' import { useSSRSafeId } from '@react-aria/ssr' import { DottedName } from 'modele-social' import { RuleNode } from 'publicodes' +import { isEmpty } from 'ramda' import { useCallback, useContext } from 'react' import { useDispatch, useSelector } from 'react-redux' import styled from 'styled-components' @@ -132,6 +133,7 @@ export function SimpleField({ aria-labelledby={displayedQuestion ? labelId : undefined} label={displayedLabel} required={meta.requis === 'oui'} + missing={!isEmpty(evaluation.missingVariables)} onChange={dispatchValue} showSuggestions={showSuggestions} /> diff --git a/site/source/pages/gerer/declaration-revenu-independants/entreprise.tsx b/site/source/pages/gerer/declaration-revenu-independants/entreprise.tsx index a76bb5c7d..492860450 100644 --- a/site/source/pages/gerer/declaration-revenu-independants/entreprise.tsx +++ b/site/source/pages/gerer/declaration-revenu-independants/entreprise.tsx @@ -1,4 +1,5 @@ import { DottedName } from '@/../../modele-social' +import { resetSimulation } from '@/actions/actions' import { resetCompany } from '@/actions/companyActions' import { TrackPage } from '@/ATInternetTracking' import { CompanyDetails } from '@/components/company/Details' @@ -106,7 +107,14 @@ export default function Accueil() { -