From 4eb26d7ffb46b32981d960937eecb7b234d7e19c Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 15 Jun 2018 11:55:53 +0200 Subject: [PATCH] =?UTF-8?q?Utiliser=20les=20s=C3=A9lecteurs=20avec=20n'imp?= =?UTF-8?q?orte=20quelles=20r=C3=A8gles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/selectors/analyseSelectors.js | 11 +++++------ test/mecanisms.test.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/selectors/analyseSelectors.js b/source/selectors/analyseSelectors.js index 62db0d319..f1efdd703 100644 --- a/source/selectors/analyseSelectors.js +++ b/source/selectors/analyseSelectors.js @@ -11,8 +11,8 @@ import { head, isEmpty, pick } from 'ramda' import { getFormValues } from 'redux-form' import { collectDefaults, - rules, - rulesFr, + rules as baseRulesEn, + rulesFr as baseRulesFr, nestedSituationToPathMap, formatInputs, findRuleByDottedName, @@ -26,11 +26,10 @@ import { * * */ -let langSelector = state => state.lang - export let flatRulesSelector = createSelector( - [langSelector], - lang => (lang === 'en' ? rules : rulesFr) + state => state.lang, + state => state.rules, + (lang, rules) => rules || (lang === 'en' ? baseRulesEn : baseRulesFr) ) let parsedRulesSelector = createSelector([flatRulesSelector], rules => diff --git a/test/mecanisms.test.js b/test/mecanisms.test.js index b7e4cb98d..ed82766b3 100644 --- a/test/mecanisms.test.js +++ b/test/mecanisms.test.js @@ -10,7 +10,7 @@ import { analyse, parseAll } from '../source/engine/traverse' import { collectMissingVariables } from '../source/engine/generateQuestions' import testSuites from './load-mecanism-tests' import * as R from 'ramda' -import { isFloat } from '../source/components/rule/Examples' +import { isFloat } from '../source/utils' describe('Mécanismes', () => testSuites.map(suite =>