@inseefr/lunatic 0.1.7 → 0.1.8-experimental
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/lib/index.js +2818 -596
- package/lib/index.js.map +1 -1
- package/package.json +87 -52
- package/src/components/breadcrumb/breadcrumb.scss +20 -0
- package/src/components/breadcrumb/component.js +29 -0
- package/src/components/breadcrumb/index.js +1 -0
- package/src/components/button/button.scss +11 -10
- package/src/components/button/component.js +43 -16
- package/src/components/checkbox/boolean.js +158 -45
- package/src/components/checkbox/checkbox.scss +55 -20
- package/src/components/checkbox/group.js +231 -0
- package/src/components/checkbox/index.js +1 -0
- package/src/components/checkbox/one.js +8 -90
- package/src/components/components.js +18 -0
- package/src/components/datepicker/component.js +11 -0
- package/src/components/datepicker/datepicker.scss +1 -0
- package/src/components/datepicker/index.js +1 -0
- package/src/components/declarations/component.js +45 -0
- package/src/components/declarations/declarations.scss +38 -0
- package/src/components/declarations/index.js +1 -0
- package/src/components/declarations/wrappers/index.js +3 -0
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +269 -0
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -0
- package/src/components/declarations/wrappers/simple-declarations-wrapper.js +54 -0
- package/src/components/dropdown/commons/actions.js +56 -0
- package/src/components/dropdown/commons/children-to-option.js +9 -0
- package/src/components/dropdown/commons/cleaner-callbacks.js +58 -0
- package/src/components/dropdown/commons/components/dropdown-container.js +29 -0
- package/src/components/dropdown/commons/components/dropdown-field.js +46 -0
- package/src/components/dropdown/commons/components/dropdown.js +183 -0
- package/src/components/dropdown/commons/components/label.js +28 -0
- package/src/components/dropdown/commons/components/panel.js +78 -0
- package/src/components/dropdown/commons/event-callbacks/index.js +5 -0
- package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +29 -0
- package/src/components/dropdown/commons/event-callbacks/on-mousedown-callback.js +11 -0
- package/src/components/dropdown/commons/reducer.js +149 -0
- package/src/components/dropdown/commons/tools/index.js +17 -0
- package/src/components/dropdown/component.js +128 -0
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +190 -0
- package/src/components/dropdown/dropdown-edit/icone.js +33 -0
- package/src/components/dropdown/dropdown-edit/index.js +11 -0
- package/src/components/dropdown/dropdown-edit/option.js +62 -0
- package/src/components/dropdown/dropdown-edit/prefix-tools.js +51 -0
- package/src/components/dropdown/dropdown-simple/dropdown.js +162 -0
- package/src/components/dropdown/dropdown-simple/index.js +20 -0
- package/src/components/dropdown/dropdown-simple/option.js +15 -0
- package/src/components/dropdown/dropdown.scss +176 -0
- package/src/components/dropdown/index.js +1 -0
- package/src/components/filter-description/component.js +42 -0
- package/src/components/filter-description/index.js +1 -0
- package/src/components/icon/assets/checkbox-checked.js +16 -0
- package/src/components/icon/assets/checkbox-unchecked.js +16 -0
- package/src/components/icon/assets/index.js +4 -0
- package/src/components/icon/assets/radio-checked.js +16 -0
- package/src/components/icon/assets/radio-unchecked.js +16 -0
- package/src/components/icon/component.js +33 -0
- package/src/components/icon/icon.scss +13 -0
- package/src/components/icon/index.js +1 -0
- package/src/components/index.js +3 -5
- package/src/components/index.scss +134 -12
- package/src/components/input/index.js +1 -0
- package/src/components/input/input-number.js +41 -106
- package/src/components/input/input.js +11 -0
- package/src/components/input/input.scss +30 -24
- package/src/components/loop/component.js +258 -0
- package/src/components/loop/index.js +1 -0
- package/src/components/loop/loop.scss +11 -0
- package/src/components/loop/wrapper.js +15 -0
- package/src/components/loop-constructor/block/block.scss +8 -0
- package/src/components/loop-constructor/block/component.js +9 -0
- package/src/components/loop-constructor/block/index.js +1 -0
- package/src/components/loop-constructor/index.js +1 -0
- package/src/components/loop-constructor/roster/component.js +8 -0
- package/src/components/loop-constructor/roster/index.js +1 -0
- package/src/components/loop-constructor/wrapper/body-component.js +122 -0
- package/src/components/loop-constructor/wrapper/build-components.js +33 -0
- package/src/components/loop-constructor/wrapper/component.js +189 -0
- package/src/components/loop-constructor/wrapper/index.js +1 -0
- package/src/components/missing-wrapper/component.js +119 -0
- package/src/components/missing-wrapper/index.js +1 -0
- package/src/components/missing-wrapper/missing.scss +30 -0
- package/src/components/missing-wrapper/wrapper.js +10 -0
- package/src/components/progress-bar/component.js +28 -0
- package/src/components/progress-bar/index.js +1 -0
- package/src/components/progress-bar/progress-bar.scss +52 -0
- package/src/components/radio/component.js +9 -0
- package/src/components/radio/index.js +1 -0
- package/src/components/radio/radio.scss +57 -0
- package/src/components/sequence/component.js +36 -13
- package/src/components/sequence/sequence.scss +6 -13
- package/src/components/subsequence/component.js +36 -14
- package/src/components/suggester/check-store.js +70 -0
- package/src/components/suggester/commons-tools/binded-keys.js +11 -0
- package/src/components/suggester/commons-tools/index.js +1 -0
- package/src/components/suggester/components/create-on-keydown-callback.js +28 -0
- package/src/components/suggester/components/index.js +2 -0
- package/src/components/suggester/components/panel/default-option-renderer.js +19 -0
- package/src/components/suggester/components/panel/index.js +2 -0
- package/src/components/suggester/components/panel/option-container.js +63 -0
- package/src/components/suggester/components/panel/panel-container.js +21 -0
- package/src/components/suggester/components/panel/panel.js +33 -0
- package/src/components/suggester/components/selection/default-label-renderer.js +31 -0
- package/src/components/suggester/components/selection/delete.js +38 -0
- package/src/components/suggester/components/selection/index.js +1 -0
- package/src/components/suggester/components/selection/label.js +31 -0
- package/src/components/suggester/components/selection/selection.js +50 -0
- package/src/components/suggester/components/suggester-content.js +42 -0
- package/src/components/suggester/components/suggester.js +87 -0
- package/src/components/suggester/components/suggester.scss +100 -0
- package/src/components/suggester/default-style.scss +122 -0
- package/src/components/suggester/idb-suggester.js +74 -0
- package/src/components/suggester/index.js +1 -0
- package/src/components/suggester/lunatic-suggester.js +148 -0
- package/src/components/suggester/searching/index.js +1 -0
- package/src/components/suggester/searching/searching.js +39 -0
- package/src/components/suggester/state-management/actions.js +35 -0
- package/src/components/suggester/state-management/index.js +6 -0
- package/src/components/suggester/state-management/intial-state.js +13 -0
- package/src/components/suggester/state-management/reducer/index.js +1 -0
- package/src/components/suggester/state-management/reducer/reduce-on-blur.js +5 -0
- package/src/components/suggester/state-management/reducer/reduce-on-change-search.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-click-option.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-error.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-focus.js +5 -0
- package/src/components/suggester/state-management/reducer/reduce-on-init.js +11 -0
- package/src/components/suggester/state-management/reducer/reduce-on-key-down.js +73 -0
- package/src/components/suggester/state-management/reducer/reduce-on-unexpected-error.js +7 -0
- package/src/components/suggester/state-management/reducer/reduce-on-update-options.js +11 -0
- package/src/components/suggester/state-management/reducer/reducer.js +35 -0
- package/src/components/suggester/state-management/suggester-context.js +4 -0
- package/src/components/suggester/state-management/use-dispatch.js +11 -0
- package/src/components/suggester/suggester-wrapper.js +101 -0
- package/src/components/suggester-loader-widget/create-append-task.js +43 -0
- package/src/components/suggester-loader-widget/index.js +1 -0
- package/src/components/suggester-loader-widget/loader-row.js +102 -0
- package/src/components/suggester-loader-widget/loader.js +67 -0
- package/src/components/suggester-loader-widget/progress.js +25 -0
- package/src/components/suggester-loader-widget/tools/action-tool.js +20 -0
- package/src/components/suggester-loader-widget/tools/index.js +2 -0
- package/src/components/suggester-loader-widget/tools/tools.js +7 -0
- package/src/components/suggester-loader-widget/widget-container.js +35 -0
- package/src/components/suggester-loader-widget/widget.js +125 -0
- package/src/components/suggester-loader-widget/widget.scss +176 -0
- package/src/components/table/index.js +1 -0
- package/src/components/table/table.js +171 -0
- package/src/components/table/table.scss +24 -0
- package/src/components/textarea/component.js +11 -0
- package/src/components/textarea/index.js +1 -0
- package/src/components/textarea/textarea.scss +6 -0
- package/src/components/tooltip/img/edited.png +0 -0
- package/src/components/tooltip/img/forced.png +0 -0
- package/src/components/tooltip/img/index.js +4 -0
- package/src/components/tooltip/index.js +1 -0
- package/src/components/tooltip/response.js +52 -0
- package/src/components/tooltip/tooltip.scss +27 -0
- package/src/constants/component-types.js +1 -0
- package/src/constants/declarations.js +14 -0
- package/src/constants/event-types.js +13 -0
- package/src/constants/index.js +5 -0
- package/src/constants/supported-preferences.js +10 -0
- package/src/constants/value-types.js +5 -0
- package/src/constants/variable-types.js +4 -0
- package/src/stories/breadcrumb/README.md +14 -0
- package/src/stories/breadcrumb/breadcrumb.stories.js +19 -0
- package/src/stories/button/button.stories.js +3 -39
- package/src/stories/checkbox-boolean/README.md +19 -12
- package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +39 -19
- package/src/stories/checkbox-boolean/data-forced.json +48 -0
- package/src/stories/checkbox-boolean/data.json +78 -0
- package/src/stories/checkbox-group/README.md +29 -0
- package/src/stories/checkbox-group/checkbox-group.stories.js +60 -0
- package/src/stories/checkbox-group/data-forced.json +89 -0
- package/src/stories/checkbox-group/data-vtl.json +102 -0
- package/src/stories/checkbox-group/data.json +89 -0
- package/src/stories/checkbox-one/README.md +21 -12
- package/src/stories/checkbox-one/checkbox-one.stories.js +41 -80
- package/src/stories/checkbox-one/data-forced.json +33 -0
- package/src/stories/checkbox-one/data-vtl.json +48 -0
- package/src/stories/checkbox-one/data.json +33 -0
- package/src/stories/datepicker/README.md +31 -0
- package/src/stories/datepicker/data-forced.json +28 -0
- package/src/stories/datepicker/data.json +43 -0
- package/src/stories/datepicker/datepicker.stories.js +60 -0
- package/src/stories/declarations/README.md +19 -0
- package/src/stories/declarations/declarations.stories.js +112 -0
- package/src/stories/dropdown/README.md +44 -0
- package/src/stories/dropdown/data-forced.json +81 -0
- package/src/stories/dropdown/data-naf.json +6963 -0
- package/src/stories/dropdown/data-props.json +111 -0
- package/src/stories/dropdown/data.json +78 -0
- package/src/stories/dropdown/dropdown.stories.js +89 -0
- package/src/stories/filter-description/README.md +15 -0
- package/src/stories/filter-description/filter-description.stories.js +53 -0
- package/src/stories/icons/icons.stories.js +16 -0
- package/src/stories/icons/lunatic-icon.scss +10 -0
- package/src/stories/input/README.md +33 -0
- package/src/stories/input/data-forced.json +41 -0
- package/src/stories/input/data.json +41 -0
- package/src/stories/input/input.stories.js +72 -0
- package/src/stories/input-number/README.md +30 -15
- package/src/stories/input-number/data-forced.json +27 -0
- package/src/stories/input-number/data.json +42 -0
- package/src/stories/input-number/input-number.stories.js +52 -48
- package/src/stories/loop/README.md +25 -0
- package/src/stories/loop/loop.stories.js +88 -0
- package/src/stories/loop/with-loop/data-loop-deeper.json +298 -0
- package/src/stories/loop/with-loop/data-loop.json +336 -0
- package/src/stories/loop/with-loop/index.js +2 -0
- package/src/stories/loop/with-roster/data-forced.json +213 -0
- package/src/stories/loop/with-roster/data-loop-deeper.json +298 -0
- package/src/stories/loop/with-roster/data-loop.json +288 -0
- package/src/stories/loop/with-roster/index.js +3 -0
- package/src/stories/loop-constructor/README.md +27 -0
- package/src/stories/loop-constructor/data-input-forced.json +64 -0
- package/src/stories/loop-constructor/data-input.json +100 -0
- package/src/stories/loop-constructor/data-loop-forced.json +66 -0
- package/src/stories/loop-constructor/data-loop-static-forced.json +66 -0
- package/src/stories/loop-constructor/data-loop-static.json +81 -0
- package/src/stories/loop-constructor/data-loop.json +81 -0
- package/src/stories/loop-constructor/data-roster-forced.json +68 -0
- package/src/stories/loop-constructor/data-roster.json +83 -0
- package/src/stories/loop-constructor/loop-constructor.stories.js +180 -0
- package/src/stories/pagination/deeper-loop.json +327 -0
- package/src/stories/pagination/pagination.stories.js +60 -0
- package/src/stories/pagination/simple-loop.json +277 -0
- package/src/stories/pagination/simpsons-question.json +4952 -0
- package/src/stories/pagination/simpsons-sequence.json +4362 -0
- package/src/stories/progress-bar/README.md +13 -0
- package/src/stories/progress-bar/progress-bar.stories.js +24 -0
- package/src/stories/questionnaire/arithmetic.json +254 -0
- package/src/stories/questionnaire/calc-var.json +187 -0
- package/src/stories/questionnaire/logement.json +23402 -0
- package/src/stories/questionnaire/questionnaire.stories.js +119 -0
- package/src/stories/questionnaire/simpsons.json +4816 -0
- package/src/stories/radio/README.md +31 -0
- package/src/stories/radio/data-forced.json +32 -0
- package/src/stories/radio/data-vtl.json +47 -0
- package/src/stories/radio/data.json +32 -0
- package/src/stories/radio/radio.stories.js +64 -0
- package/src/stories/sequence/README.md +10 -5
- package/src/stories/sequence/sequence.stories.js +8 -26
- package/src/stories/subsequence/README.md +10 -5
- package/src/stories/subsequence/subsequence.stories.js +8 -26
- package/src/stories/suggester/README.md +29 -0
- package/src/stories/suggester/cog-communes/fetch-cog.js +11 -0
- package/src/stories/suggester/cog-communes/index.js +2 -0
- package/src/stories/suggester/cog-communes/option-cog-renderer.js +15 -0
- package/src/stories/suggester/cog-communes/theme.scss +12 -0
- package/src/stories/suggester/data-auto.json +231 -0
- package/src/stories/suggester/data-vtl.json +82 -0
- package/src/stories/suggester/data.json +83 -0
- package/src/stories/suggester/naf-rev2/fetch-naf.js +57 -0
- package/src/stories/suggester/naf-rev2/index.js +2 -0
- package/src/stories/suggester/naf-rev2/option-renderer.js +17 -0
- package/src/stories/suggester/naf-rev2/theme.scss +36 -0
- package/src/stories/suggester/suggester.stories.js +128 -0
- package/src/stories/table/README.md +29 -0
- package/src/stories/table/data-default.json +19 -0
- package/src/stories/table/data-one-axis-one-measure.json +139 -0
- package/src/stories/table/data-one-axis-two-measures.json +208 -0
- package/src/stories/table/data-one-hierarchical-axis.json +219 -0
- package/src/stories/table/data-roster.json +486 -0
- package/src/stories/table/data-two-axis-one-measure.json +507 -0
- package/src/stories/table/table.stories.js +82 -0
- package/src/stories/textarea/README.md +33 -0
- package/src/stories/textarea/data-forced.json +28 -0
- package/src/stories/textarea/data.json +43 -0
- package/src/stories/textarea/textarea.stories.js +68 -0
- package/src/stories/tooltip-response/README.md +14 -0
- package/src/stories/tooltip-response/md-link.json +31 -0
- package/src/stories/tooltip-response/md-tooltip.json +31 -0
- package/src/stories/tooltip-response/tooltip.stories.js +83 -0
- package/src/stories/utils/custom-lunatic.scss +23 -0
- package/src/stories/utils/img/arrow.png +0 -0
- package/src/stories/utils/img/check_box.svg +1 -0
- package/src/stories/utils/img/check_box_outline.svg +1 -0
- package/src/stories/utils/img/lunatic-logo.png +0 -0
- package/src/stories/utils/img/menu-down.svg +1 -0
- package/src/stories/utils/img/menu-up.svg +1 -0
- package/src/stories/utils/img/radio_button_checked.svg +1 -0
- package/src/stories/utils/img/radio_button_unchecked.svg +1 -0
- package/src/stories/utils/options.js +25 -0
- package/src/stories/utils/orchestrator.js +108 -0
- package/src/tests/components/breadcrumb.spec.js +13 -0
- package/src/tests/components/checkbox-boolean.spec.js +28 -40
- package/src/tests/components/checkbox-group.spec.js +53 -0
- package/src/tests/components/checkbox-one.spec.js +21 -39
- package/src/tests/components/datepicker.spec.js +22 -0
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -0
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -0
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -0
- package/src/tests/components/declarations.spec.js +46 -0
- package/src/tests/components/input-number.spec.js +136 -37
- package/src/tests/components/input.spec.js +18 -0
- package/src/tests/components/loops/loop-static.json +66 -0
- package/src/tests/components/loops/loop.json +258 -0
- package/src/tests/components/loops/loop.spec.js +30 -0
- package/src/tests/components/loops/roster-for-loop.spec.js +18 -0
- package/src/tests/components/loops/roster-loop.json +69 -0
- package/src/tests/components/missing-wrapper.spec.js +33 -0
- package/src/tests/components/progress-bar.spec.js +15 -0
- package/src/tests/components/radio.spec.js +27 -0
- package/src/tests/components/table.spec.js +11 -0
- package/src/tests/components/textarea.spec.js +18 -0
- package/src/tests/components/tooltip.spec.js +25 -0
- package/src/tests/setup/setupTests.js +1 -1
- package/src/tests/utils/lib/alphabet.spec.js +36 -0
- package/src/tests/utils/lib/array.spec.js +22 -0
- package/src/tests/utils/lib/checkbox/group.spec.js +72 -0
- package/src/tests/utils/{decorator → lib/decorator}/title-decorator.spec.js +1 -1
- package/src/tests/utils/lib/input-number.spec.js +18 -0
- package/src/tests/utils/{items-positioning.spec.js → lib/items-positioning.spec.js} +3 -3
- package/src/tests/utils/{label-position.spec.js → lib/label-position.spec.js} +6 -3
- package/src/tests/utils/lib/loops/bindings.spec.js +75 -0
- package/src/tests/utils/lib/loops/shared.spec.js +82 -0
- package/src/tests/utils/lib/missing/missing.spec.js +74 -0
- package/src/tests/utils/lib/missing/mock.js +137 -0
- package/src/tests/utils/lib/pagination/shared.spec.js +42 -0
- package/src/tests/utils/lib/responses.spec.js +64 -0
- package/src/tests/utils/{string-utils.spec.js → lib/style.spec.js} +6 -6
- package/src/tests/utils/lib/table/roster.spec.js +25 -0
- package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -0
- package/src/tests/utils/lib/tooltip/content.spec.js +109 -0
- package/src/tests/utils/to-expose/handler/handler.spec.js +94 -0
- package/src/tests/utils/to-expose/handler/questionnaire.json +158 -0
- package/src/tests/utils/to-expose/handler/results/index.js +6 -0
- package/src/tests/utils/to-expose/handler/results/res-double.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -0
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +46 -0
- package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -0
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -0
- package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +141 -0
- package/src/tests/utils/to-expose/init-questionnaire/result.json +174 -0
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -0
- package/src/tests/utils/to-expose/state/questionnaire.json +61 -0
- package/src/tests/utils/to-expose/state/results.js +78 -0
- package/src/tests/utils/to-expose/state/state.spec.js +59 -0
- package/src/utils/components/dragger/dragger.js +64 -0
- package/src/utils/components/dragger/dragger.scss +8 -0
- package/src/utils/components/dragger/index.js +1 -0
- package/src/utils/components/fab/fab.js +50 -0
- package/src/utils/components/fab/fab.scss +32 -0
- package/src/utils/components/fab/index.js +1 -0
- package/src/utils/components/field-wrapper.js +23 -0
- package/src/utils/components/is-network/index.js +1 -0
- package/src/utils/components/is-network/is-network.js +39 -0
- package/src/utils/components/is-network/use-online-status.js +51 -0
- package/src/utils/components/label-wrapper.js +45 -0
- package/src/utils/icons/closed.icon.js +24 -0
- package/src/utils/icons/cross.icon.js +24 -0
- package/src/utils/icons/load.icon.js +24 -0
- package/src/utils/icons/lunatic-icon.js +9 -0
- package/src/utils/icons/lunatic-icon.scss +4 -0
- package/src/utils/icons/network.icon.js +24 -0
- package/src/utils/icons/on-drag.icon.js +24 -0
- package/src/utils/icons/opened.icon.js +24 -0
- package/src/utils/idb-tools/clear-store.js +16 -0
- package/src/utils/idb-tools/get-entity.js +15 -0
- package/src/utils/idb-tools/get-idb.js +12 -0
- package/src/utils/idb-tools/index.js +4 -0
- package/src/utils/idb-tools/open-db.js +32 -0
- package/src/utils/lib/alphabet.js +1 -0
- package/src/utils/lib/array.js +7 -0
- package/src/utils/lib/checkbox/group.js +21 -0
- package/src/utils/lib/checkbox/index.js +1 -0
- package/src/utils/lib/decorator/index.js +1 -0
- package/src/utils/lib/decorator/title-decorator.js +16 -0
- package/src/utils/lib/env.js +2 -0
- package/src/utils/lib/event.js +15 -0
- package/src/utils/lib/function.js +1 -0
- package/src/utils/lib/index.js +19 -0
- package/src/utils/lib/input-number.js +6 -0
- package/src/utils/{label-position.js → lib/label-position.js} +4 -4
- package/src/utils/lib/loops/bindings.js +66 -0
- package/src/utils/lib/loops/build-components.js +33 -0
- package/src/utils/lib/loops/index.js +3 -0
- package/src/utils/lib/loops/shared.js +55 -0
- package/src/utils/lib/memo-check.js +24 -0
- package/src/utils/lib/missing.js +52 -0
- package/src/utils/{items-positioning.js → lib/options-positioning.js} +1 -1
- package/src/utils/lib/pagination/flow.js +2 -0
- package/src/utils/lib/pagination/index.js +2 -0
- package/src/utils/lib/pagination/navigation/index.js +1 -0
- package/src/utils/lib/pagination/navigation/shared.js +108 -0
- package/src/utils/lib/prop-types/declarations.js +22 -0
- package/src/utils/lib/prop-types/index.js +5 -0
- package/src/utils/lib/prop-types/lines.js +6 -0
- package/src/utils/lib/prop-types/options.js +8 -0
- package/src/utils/lib/prop-types/response.js +6 -0
- package/src/utils/lib/prop-types/value-type.js +9 -0
- package/src/utils/lib/responses.js +9 -0
- package/src/utils/{string-utils.js → lib/style.js} +0 -0
- package/src/utils/lib/table/index.js +1 -0
- package/src/utils/lib/table/roster.js +23 -0
- package/src/utils/lib/tooltip/build-response.js +41 -0
- package/src/utils/lib/tooltip/content.js +55 -0
- package/src/utils/lib/tooltip/index.js +6 -0
- package/src/utils/store-tools/auto-load.js +72 -0
- package/src/utils/store-tools/clear-store-data.js +8 -0
- package/src/utils/store-tools/clear-store-info.js +8 -0
- package/src/utils/store-tools/constantes.js +20 -0
- package/src/utils/store-tools/create/create.js +19 -0
- package/src/utils/store-tools/create/index.js +1 -0
- package/src/utils/store-tools/create/update-store-info.js +26 -0
- package/src/utils/store-tools/get-store-count.js +22 -0
- package/src/utils/store-tools/index.js +5 -0
- package/src/utils/store-tools/open-or-create-store.js +47 -0
- package/src/utils/store-tools/use-store-index.js +24 -0
- package/src/utils/to-expose/handler.js +137 -0
- package/src/utils/to-expose/hooks/filter-components.js +106 -0
- package/src/utils/to-expose/hooks/index.js +1 -0
- package/src/utils/to-expose/hooks/lunatic.js +191 -0
- package/src/utils/to-expose/hooks/use-document-add-event-listener.js +63 -0
- package/src/utils/to-expose/index.js +11 -0
- package/src/utils/to-expose/init-questionnaire.js +223 -0
- package/src/utils/to-expose/interpret/index.js +1 -0
- package/src/utils/to-expose/interpret/main.js +16 -0
- package/src/utils/to-expose/interpret/md.js +65 -0
- package/src/utils/to-expose/interpret/vtl.js +18 -0
- package/src/utils/to-expose/state.js +58 -0
- package/src/components/subsequence/subsequence.scss +0 -15
- package/src/utils/decorator/title-decorator.js +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getItemsPositioningClass } from 'utils/
|
|
1
|
+
import { getItemsPositioningClass } from 'utils/lib';
|
|
2
2
|
|
|
3
3
|
describe('string utils', () => {
|
|
4
4
|
describe('getItemsPositioningClass', () => {
|
|
@@ -8,9 +8,9 @@ describe('string utils', () => {
|
|
|
8
8
|
expect(getItemsPositioningClass('DEFAULT')).toEqual('');
|
|
9
9
|
expect(getItemsPositioningClass('VERTICAL')).toEqual('');
|
|
10
10
|
});
|
|
11
|
-
it('should return "horizontal-
|
|
11
|
+
it('should return "horizontal-options"', () => {
|
|
12
12
|
expect(getItemsPositioningClass('HORIZONTAL')).toEqual(
|
|
13
|
-
'horizontal-
|
|
13
|
+
'horizontal-options'
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getLabelPositionClass } from 'utils/
|
|
1
|
+
import { getLabelPositionClass } from 'utils/lib';
|
|
2
2
|
|
|
3
3
|
describe('string utils', () => {
|
|
4
4
|
describe('getLabelPositionClass', () => {
|
|
5
5
|
it('should return default value', () => {
|
|
6
|
-
expect(getLabelPositionClass()).toEqual('label-
|
|
7
|
-
expect(getLabelPositionClass('')).toEqual('label-
|
|
6
|
+
expect(getLabelPositionClass()).toEqual('label-top');
|
|
7
|
+
expect(getLabelPositionClass('')).toEqual('label-top');
|
|
8
8
|
});
|
|
9
9
|
it('should return "label-top"', () => {
|
|
10
10
|
expect(getLabelPositionClass('TOP')).toEqual('label-top');
|
|
@@ -15,5 +15,8 @@ describe('string utils', () => {
|
|
|
15
15
|
it('should return "label-right"', () => {
|
|
16
16
|
expect(getLabelPositionClass('RIGHT')).toEqual('label-right');
|
|
17
17
|
});
|
|
18
|
+
it('should return "label-left"', () => {
|
|
19
|
+
expect(getLabelPositionClass('LEFT')).toEqual('label-left');
|
|
20
|
+
});
|
|
18
21
|
});
|
|
19
22
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
const bindings = { A: 'AAA', B: ['b', 'bb'] };
|
|
4
|
+
|
|
5
|
+
describe('loop bindings utils', () => {
|
|
6
|
+
describe('buildBindingsForDeeperComponents', () => {
|
|
7
|
+
it('should return default value', () => {
|
|
8
|
+
expect(U.buildBindingsForDeeperComponents()()).toEqual({});
|
|
9
|
+
expect(U.buildBindingsForDeeperComponents(0)()).toEqual({});
|
|
10
|
+
expect(U.buildBindingsForDeeperComponents()({})).toEqual({});
|
|
11
|
+
});
|
|
12
|
+
it('should return bindings for loop', () => {
|
|
13
|
+
expect(U.buildBindingsForDeeperComponents(1)(bindings)).toEqual({
|
|
14
|
+
A: 'AAA',
|
|
15
|
+
B: 'bb',
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('buildLoopBindings', () => {
|
|
20
|
+
it('should return default value', () => {
|
|
21
|
+
expect(U.buildLoopBindings(0)()).toEqual({});
|
|
22
|
+
expect(U.buildLoopBindings(0)({})).toEqual({});
|
|
23
|
+
});
|
|
24
|
+
it('should return bindings for loop', () => {
|
|
25
|
+
expect(
|
|
26
|
+
U.buildLoopBindings(1)([
|
|
27
|
+
['a', 'A'],
|
|
28
|
+
['b', ['B0', 'B1']],
|
|
29
|
+
])
|
|
30
|
+
).toEqual({
|
|
31
|
+
a: 'A',
|
|
32
|
+
b: 'B1',
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe('buildVectorialBindings', () => {
|
|
37
|
+
it('should return default value', () => {
|
|
38
|
+
expect(U.buildVectorialBindings()).toEqual({});
|
|
39
|
+
expect(U.buildVectorialBindings({})).toEqual({});
|
|
40
|
+
});
|
|
41
|
+
it('should return vectorial bindings', () => {
|
|
42
|
+
expect(U.buildVectorialBindings(bindings)).toEqual({
|
|
43
|
+
A: 'AAA',
|
|
44
|
+
B: { dataStructure: { B: {} }, dataPoints: { B: ['b', 'bb'] } },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('displayLoop', () => {
|
|
49
|
+
it('should return default value', () => {
|
|
50
|
+
expect(U.displayLoop()()).toBeFalsy();
|
|
51
|
+
expect(U.displayLoop([])({})).toBeFalsy();
|
|
52
|
+
});
|
|
53
|
+
it('should return display loop', () => {
|
|
54
|
+
expect(U.displayLoop(['A'])({ A: [null] })).toBeFalsy();
|
|
55
|
+
});
|
|
56
|
+
it('should return display loop', () => {
|
|
57
|
+
expect(U.displayLoop(['A'])({ A: ['a'] })).toBeTruthy();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('displayLoopQuestion', () => {
|
|
61
|
+
it('should return default value', () => {
|
|
62
|
+
expect(U.displayLoopQuestion()()).toBeFalsy();
|
|
63
|
+
expect(U.displayLoopQuestion([])({})).toBeFalsy();
|
|
64
|
+
});
|
|
65
|
+
it('should return display loop', () => {
|
|
66
|
+
expect(
|
|
67
|
+
U.displayLoopQuestion(['A', 'B'])({ A: [[null]], B: null })
|
|
68
|
+
).toBeFalsy();
|
|
69
|
+
});
|
|
70
|
+
it('should return display loop', () => {
|
|
71
|
+
expect(U.displayLoopQuestion(['A'])({ A: [[null]] })).toBeTruthy();
|
|
72
|
+
expect(U.displayLoopQuestion(['A'])({ A: 'a' })).toBeTruthy();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
const componentsForInit = [
|
|
4
|
+
{
|
|
5
|
+
id: '1',
|
|
6
|
+
response: { name: 'a', values: { COLLECTED: [null, 'a'] } },
|
|
7
|
+
missingResponse: { name: 'z', depth: 0 },
|
|
8
|
+
depth: 0,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: '2',
|
|
12
|
+
response: { name: 'b', values: { COLLECTED: [null, 'b'] } },
|
|
13
|
+
depth: 0,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '3',
|
|
17
|
+
responses: [
|
|
18
|
+
{
|
|
19
|
+
id: '3.1',
|
|
20
|
+
depth: 1,
|
|
21
|
+
response: { name: 'c', values: { COLLECTED: [null, null] } },
|
|
22
|
+
missingResponse: { name: 'zz', depth: 1 },
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
describe('loop roster utils', () => {
|
|
29
|
+
describe('getLoopConstructorInitLines', () => {
|
|
30
|
+
it('should return default value', () => {
|
|
31
|
+
expect(U.getLoopConstructorInitLines()).toEqual(0);
|
|
32
|
+
expect(U.getLoopConstructorInitLines([])).toEqual(0);
|
|
33
|
+
});
|
|
34
|
+
it('should return roster init line length', () => {
|
|
35
|
+
expect(U.getLoopConstructorInitLines(componentsForInit)).toEqual(2);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('getInvolvedVariables', () => {
|
|
39
|
+
it('should return default value', () => {
|
|
40
|
+
expect(U.getInvolvedVariables()).toEqual([]);
|
|
41
|
+
expect(U.getInvolvedVariables([])).toEqual([]);
|
|
42
|
+
});
|
|
43
|
+
it('should return variables involved into roster for loop', () => {
|
|
44
|
+
expect(U.getInvolvedVariables(componentsForInit)).toEqual([
|
|
45
|
+
{ name: 'a', depth: 0 },
|
|
46
|
+
{ name: 'z', depth: 0 },
|
|
47
|
+
{ name: 'b', depth: 0 },
|
|
48
|
+
{ name: 'c', depth: 1 },
|
|
49
|
+
{ name: 'zz', depth: 1 },
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('lastLoopChildLineIsEmpty', () => {
|
|
54
|
+
it('should return default value', () => {
|
|
55
|
+
expect(U.lastLoopChildLineIsEmpty()()).toBeTruthy();
|
|
56
|
+
expect(U.lastLoopChildLineIsEmpty({})([])).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
it('should return last line is not empty', () => {
|
|
59
|
+
const d = { A: [null, 'a'], B: ['b', null] };
|
|
60
|
+
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
61
|
+
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeFalsy();
|
|
62
|
+
});
|
|
63
|
+
it('should return last line is empty', () => {
|
|
64
|
+
const d = { A: [null, null], B: ['b', null] };
|
|
65
|
+
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
66
|
+
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeTruthy();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('buildEmptyValue', () => {
|
|
71
|
+
it('should return default value', () => {
|
|
72
|
+
expect(U.buildEmptyValue()).toBeNull();
|
|
73
|
+
expect(U.buildEmptyValue(0)).toBeNull();
|
|
74
|
+
expect(U.buildEmptyValue(1)).toBeNull();
|
|
75
|
+
expect(U.buildEmptyValue(2)).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
it('should return null array thanks to depth', () => {
|
|
78
|
+
expect(U.buildEmptyValue(3)).toEqual([null]);
|
|
79
|
+
expect(U.buildEmptyValue(4)).toEqual([[null]]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
import * as M from './mock';
|
|
3
|
+
|
|
4
|
+
describe('buildLoopMissingResponse', () => {
|
|
5
|
+
it('should return default value', () => {
|
|
6
|
+
expect(U.buildLoopMissingResponse()({})).toBeUndefined();
|
|
7
|
+
expect(U.buildLoopMissingResponse(0)()).toBeUndefined();
|
|
8
|
+
});
|
|
9
|
+
it('should return new missingResponse', () => {
|
|
10
|
+
expect(
|
|
11
|
+
U.buildLoopMissingResponse([1])({
|
|
12
|
+
name: 'var',
|
|
13
|
+
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
14
|
+
})
|
|
15
|
+
).toEqual({
|
|
16
|
+
name: 'var',
|
|
17
|
+
values: { COLLECTED: 1, EDITED: 2 },
|
|
18
|
+
});
|
|
19
|
+
expect(
|
|
20
|
+
U.buildLoopMissingResponse([0])({
|
|
21
|
+
name: 'var',
|
|
22
|
+
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
23
|
+
})
|
|
24
|
+
).toEqual({
|
|
25
|
+
name: 'var',
|
|
26
|
+
values: { COLLECTED: null, EDITED: null },
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should return getToClean for response', () => {
|
|
30
|
+
expect(U.getToClean('COLLECTED')(M.qRespTrue)).toEqual({
|
|
31
|
+
response: null,
|
|
32
|
+
});
|
|
33
|
+
expect(U.getToClean('COLLECTED')(M.qRespFalse)).toEqual({});
|
|
34
|
+
});
|
|
35
|
+
it('should return getToClean for responses', () => {
|
|
36
|
+
expect(U.getToClean('COLLECTED')(M.qRespsTrue)).toEqual({
|
|
37
|
+
response1: null,
|
|
38
|
+
response2: null,
|
|
39
|
+
});
|
|
40
|
+
expect(U.getToClean('COLLECTED')(M.qRespsFalse)).toEqual({});
|
|
41
|
+
});
|
|
42
|
+
it('should return getToClean for cells', () => {
|
|
43
|
+
expect(U.getToClean('COLLECTED')(M.qCellsTrue)).toEqual({
|
|
44
|
+
response2: null,
|
|
45
|
+
});
|
|
46
|
+
expect(U.getToClean('COLLECTED')(M.qCellsFalse)).toEqual({});
|
|
47
|
+
});
|
|
48
|
+
it('should return getToClean for components', () => {
|
|
49
|
+
expect(U.getToClean('COLLECTED')(M.qComponentsTrue)).toEqual({
|
|
50
|
+
response2: [
|
|
51
|
+
[null, null],
|
|
52
|
+
[null, null],
|
|
53
|
+
],
|
|
54
|
+
response3: null,
|
|
55
|
+
});
|
|
56
|
+
expect(U.getToClean('COLLECTED')(M.qComponentsFalse)).toEqual({});
|
|
57
|
+
});
|
|
58
|
+
it('should return hasToCleanMissing for response', () => {
|
|
59
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespTrue)).toBeTruthy();
|
|
60
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespFalse)).toBeFalsy();
|
|
61
|
+
});
|
|
62
|
+
it('should return hasToCleanMissing for responses', () => {
|
|
63
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsTrue)).toBeTruthy();
|
|
64
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsFalse)).toBeFalsy();
|
|
65
|
+
});
|
|
66
|
+
it('should return hasToCleanMissing for cells', () => {
|
|
67
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsTrue)).toBeTruthy();
|
|
68
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsFalse)).toBeFalsy();
|
|
69
|
+
});
|
|
70
|
+
it('should return hasToCleanMissing for components', () => {
|
|
71
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsTrue)).toBeTruthy();
|
|
72
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsFalse)).toBeFalsy();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export const qRespTrue = {
|
|
2
|
+
response: { name: 'response', values: { COLLECTED: 'toto' } },
|
|
3
|
+
missingResponse: {
|
|
4
|
+
name: 'missingResponse',
|
|
5
|
+
values: { COLLECTED: 'toto' },
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const qRespFalse = {
|
|
10
|
+
response: { name: 'response', values: { COLLECTED: null } },
|
|
11
|
+
missingResponse: {
|
|
12
|
+
name: 'missingResponse',
|
|
13
|
+
values: { COLLECTED: 'toto' },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const qRespsTrue = {
|
|
18
|
+
responses: [
|
|
19
|
+
{
|
|
20
|
+
response: { name: 'response1', values: { COLLECTED: 'ok' } },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
response: { name: 'response2', values: { COLLECTED: 'ok' } },
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
missingResponse: {
|
|
27
|
+
name: 'missingResponse',
|
|
28
|
+
values: { COLLECTED: 'toto' },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const qRespsFalse = {
|
|
33
|
+
responses: [
|
|
34
|
+
{
|
|
35
|
+
response: { name: 'response1', values: { COLLECTED: null } },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
response: { name: 'response2', values: { COLLECTED: null } },
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
missingResponse: {
|
|
42
|
+
name: 'missingResponse',
|
|
43
|
+
values: { COLLECTED: 'toto' },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const qCellsTrue = {
|
|
48
|
+
cells: [
|
|
49
|
+
[
|
|
50
|
+
{ label: 'line1' },
|
|
51
|
+
{
|
|
52
|
+
response: { name: 'response1', values: { COLLECTED: null } },
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
{ label: 'line2' },
|
|
57
|
+
{
|
|
58
|
+
response: { name: 'response2', values: { COLLECTED: 'ok' } },
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const qCellsFalse = {
|
|
65
|
+
cells: [
|
|
66
|
+
[
|
|
67
|
+
{ label: 'line1' },
|
|
68
|
+
{
|
|
69
|
+
response: { name: 'response1', values: { COLLECTED: null } },
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
{ label: 'line2' },
|
|
74
|
+
{
|
|
75
|
+
response: { name: 'response2', values: { COLLECTED: null } },
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const qComponentsTrue = {
|
|
82
|
+
components: [
|
|
83
|
+
{
|
|
84
|
+
response: { name: 'response1', values: { COLLECTED: null } },
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
responses: [
|
|
88
|
+
{
|
|
89
|
+
response: {
|
|
90
|
+
name: 'response2',
|
|
91
|
+
values: {
|
|
92
|
+
COLLECTED: [
|
|
93
|
+
['ok', 'ok'],
|
|
94
|
+
['ok', 'ok'],
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
cells: [
|
|
103
|
+
[
|
|
104
|
+
{ label: 'line1' },
|
|
105
|
+
{
|
|
106
|
+
response: { name: 'response3', values: { COLLECTED: 'ok' } },
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const qComponentsFalse = {
|
|
115
|
+
components: [
|
|
116
|
+
{
|
|
117
|
+
response: { name: 'response1', values: { COLLECTED: null } },
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
responses: [
|
|
121
|
+
{
|
|
122
|
+
response: { name: 'response2', values: { COLLECTED: null } },
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
cells: [
|
|
128
|
+
[
|
|
129
|
+
{ label: 'line1' },
|
|
130
|
+
{
|
|
131
|
+
response: { name: 'response3', values: { COLLECTED: null } },
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { splitPage } from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
describe('string utils', () => {
|
|
4
|
+
describe('splitPage', () => {
|
|
5
|
+
it('should return splitted pages without depth', () => {
|
|
6
|
+
const {
|
|
7
|
+
currentRootPage,
|
|
8
|
+
currentComponentIndex,
|
|
9
|
+
currentIteration,
|
|
10
|
+
currentPageWithoutAnyIteration,
|
|
11
|
+
} = splitPage('1.2#3.10#1');
|
|
12
|
+
expect(currentRootPage).toEqual('1.2#3');
|
|
13
|
+
expect(currentComponentIndex).toEqual(10);
|
|
14
|
+
expect(currentIteration).toEqual(1);
|
|
15
|
+
expect(currentPageWithoutAnyIteration).toEqual('1.2.10');
|
|
16
|
+
});
|
|
17
|
+
it('should return splitted pages with depth 1', () => {
|
|
18
|
+
const {
|
|
19
|
+
currentRootPage,
|
|
20
|
+
currentComponentIndex,
|
|
21
|
+
currentIteration,
|
|
22
|
+
currentPageWithoutAnyIteration,
|
|
23
|
+
} = splitPage('1.2#3.10#1', 1);
|
|
24
|
+
expect(currentRootPage).toEqual('1');
|
|
25
|
+
expect(currentComponentIndex).toEqual(2);
|
|
26
|
+
expect(currentIteration).toEqual(3);
|
|
27
|
+
expect(currentPageWithoutAnyIteration).toEqual('1.2');
|
|
28
|
+
});
|
|
29
|
+
it('should return splitted pages with depth 2', () => {
|
|
30
|
+
const {
|
|
31
|
+
currentRootPage,
|
|
32
|
+
currentComponentIndex,
|
|
33
|
+
currentIteration,
|
|
34
|
+
currentPageWithoutAnyIteration,
|
|
35
|
+
} = splitPage('1.2#3.10#1', 2);
|
|
36
|
+
expect(currentRootPage).toEqual('1.2#3');
|
|
37
|
+
expect(currentComponentIndex).toEqual(10);
|
|
38
|
+
expect(currentIteration).toEqual(1);
|
|
39
|
+
expect(currentPageWithoutAnyIteration).toEqual('1.2.10');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as R from 'utils/lib/responses';
|
|
2
|
+
|
|
3
|
+
describe('responses utils', () => {
|
|
4
|
+
describe('getResponseName', () => {
|
|
5
|
+
it('should return default value', () => {
|
|
6
|
+
expect(R.getResponseName({})).toEqual('');
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
describe('getResponseByPreference', () => {
|
|
10
|
+
it('should return default value', () => {
|
|
11
|
+
expect(R.getResponseByPreference([])({})).toEqual(null);
|
|
12
|
+
expect(
|
|
13
|
+
R.getResponseByPreference([])({
|
|
14
|
+
name: 'name',
|
|
15
|
+
values: { COLLECTED: 'Collected' },
|
|
16
|
+
})
|
|
17
|
+
).toEqual(null);
|
|
18
|
+
});
|
|
19
|
+
it('should return Collected', () => {
|
|
20
|
+
expect(
|
|
21
|
+
R.getResponseByPreference(['COLLECTED'])({
|
|
22
|
+
name: 'name',
|
|
23
|
+
values: { COLLECTED: 'Collected' },
|
|
24
|
+
})
|
|
25
|
+
).toEqual('Collected');
|
|
26
|
+
});
|
|
27
|
+
it('should return Collected', () => {
|
|
28
|
+
expect(
|
|
29
|
+
R.getResponseByPreference(['COLLECTED'])({
|
|
30
|
+
name: 'name',
|
|
31
|
+
values: { COLLECTED: 'Collected', FORCED: 'Forced' },
|
|
32
|
+
})
|
|
33
|
+
).toEqual('Collected');
|
|
34
|
+
});
|
|
35
|
+
it('should return Collected', () => {
|
|
36
|
+
expect(
|
|
37
|
+
R.getResponseByPreference(['COLLECTED', 'FORCED'])({
|
|
38
|
+
name: 'name',
|
|
39
|
+
values: {
|
|
40
|
+
COLLECTED: 'Collected',
|
|
41
|
+
FORCED: null,
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
).toEqual('Collected');
|
|
45
|
+
});
|
|
46
|
+
it('should return Forced', () => {
|
|
47
|
+
expect(
|
|
48
|
+
R.getResponseByPreference(['COLLECTED', 'FORCED'])({
|
|
49
|
+
name: 'name',
|
|
50
|
+
values: { COLLECTED: 'Collected', FORCED: 'Forced' },
|
|
51
|
+
})
|
|
52
|
+
).toEqual('Forced');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return ""', () => {
|
|
56
|
+
expect(
|
|
57
|
+
R.getResponseByPreference(['COLLECTED', 'FORCED', 'EDITED'])({
|
|
58
|
+
name: 'name',
|
|
59
|
+
values: { COLLECTED: 'Collected', FORCED: '', EDITED: null },
|
|
60
|
+
})
|
|
61
|
+
).toEqual('');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { buildStyleObject } from 'utils/lib';
|
|
2
2
|
|
|
3
|
-
describe('
|
|
3
|
+
describe('style', () => {
|
|
4
4
|
describe('buildStyleObject', () => {
|
|
5
5
|
it('should return an empty object', () => {
|
|
6
|
-
expect(
|
|
7
|
-
expect(
|
|
6
|
+
expect(buildStyleObject()).toEqual({});
|
|
7
|
+
expect(buildStyleObject({})).toEqual({});
|
|
8
8
|
});
|
|
9
9
|
it('should return same object', () => {
|
|
10
|
-
expect(
|
|
10
|
+
expect(buildStyleObject({ border: 'border' })).toEqual({
|
|
11
11
|
border: 'border',
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
it('should return object with camelCase keys', () => {
|
|
15
15
|
expect(
|
|
16
|
-
|
|
16
|
+
buildStyleObject({
|
|
17
17
|
'border-top': '10',
|
|
18
18
|
':hover': { 'background-color': 'pink' },
|
|
19
19
|
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getRosterInitLines } from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
const emptyCells = [[{ response: { values: { '': null } } }]];
|
|
4
|
+
const cells = [
|
|
5
|
+
[
|
|
6
|
+
{ response: { values: { '': 'ok' } } },
|
|
7
|
+
{ response: { values: { '': 'ok2' } } },
|
|
8
|
+
],
|
|
9
|
+
[{ response: { values: { '': 'ok' } } }],
|
|
10
|
+
[],
|
|
11
|
+
[{ response: { values: { '': null } } }],
|
|
12
|
+
[{ response: { values: { '1': 'ok', '2': 'ok2' } } }],
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
describe('roster utils', () => {
|
|
16
|
+
describe('getRosterInitLines', () => {
|
|
17
|
+
it('should return 0', () => {
|
|
18
|
+
expect(getRosterInitLines()).toEqual(0);
|
|
19
|
+
expect(getRosterInitLines(emptyCells)).toEqual(0);
|
|
20
|
+
});
|
|
21
|
+
it('should return 2', () => {
|
|
22
|
+
expect(getRosterInitLines(cells)).toEqual(3);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMultiTooltipResponse,
|
|
3
|
+
buildBooleanTooltipResponse,
|
|
4
|
+
} from 'utils/lib';
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
{ value: '1', label: 'Yes' },
|
|
8
|
+
{ value: '0', label: 'No' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const responseNull = {
|
|
12
|
+
name: 'Response',
|
|
13
|
+
values: {
|
|
14
|
+
PREVIOUS: null,
|
|
15
|
+
COLLECTED: null,
|
|
16
|
+
FORCED: null,
|
|
17
|
+
EDITED: null,
|
|
18
|
+
INPUTED: null,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const response = {
|
|
23
|
+
name: 'Response',
|
|
24
|
+
values: {
|
|
25
|
+
PREVIOUS: null,
|
|
26
|
+
COLLECTED: '1',
|
|
27
|
+
FORCED: '0',
|
|
28
|
+
EDITED: '1',
|
|
29
|
+
INPUTED: null,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const finalResponse = {
|
|
34
|
+
name: 'Response',
|
|
35
|
+
values: {
|
|
36
|
+
PREVIOUS: null,
|
|
37
|
+
COLLECTED: 'Yes',
|
|
38
|
+
FORCED: 'No',
|
|
39
|
+
EDITED: 'Yes',
|
|
40
|
+
INPUTED: null,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const booleanResponse = {
|
|
45
|
+
name: 'Response',
|
|
46
|
+
values: {
|
|
47
|
+
PREVIOUS: null,
|
|
48
|
+
COLLECTED: true,
|
|
49
|
+
FORCED: false,
|
|
50
|
+
EDITED: true,
|
|
51
|
+
INPUTED: null,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const booleanFinalResponse = {
|
|
56
|
+
name: 'Response',
|
|
57
|
+
values: {
|
|
58
|
+
PREVIOUS: null,
|
|
59
|
+
COLLECTED: 'Vrai',
|
|
60
|
+
FORCED: 'Faux',
|
|
61
|
+
EDITED: 'Vrai',
|
|
62
|
+
INPUTED: null,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
describe('build response', () => {
|
|
67
|
+
describe('buildMultiTooltipResponse', () => {
|
|
68
|
+
it('should return default value', () => {
|
|
69
|
+
expect(buildMultiTooltipResponse()()).toEqual({});
|
|
70
|
+
});
|
|
71
|
+
it('should return same response', () => {
|
|
72
|
+
expect(buildMultiTooltipResponse(options)(responseNull)).toEqual(
|
|
73
|
+
responseNull
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
it('should return updated response', () => {
|
|
77
|
+
expect(buildMultiTooltipResponse(options)(response)).toEqual(
|
|
78
|
+
finalResponse
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('buildBooleanTooltipResponse', () => {
|
|
83
|
+
it('should return default value', () => {
|
|
84
|
+
expect(buildBooleanTooltipResponse()).toEqual({});
|
|
85
|
+
});
|
|
86
|
+
it('should return same response', () => {
|
|
87
|
+
expect(buildBooleanTooltipResponse(responseNull)).toEqual(responseNull);
|
|
88
|
+
});
|
|
89
|
+
it('should return updated response', () => {
|
|
90
|
+
expect(buildBooleanTooltipResponse(booleanResponse)).toEqual(
|
|
91
|
+
booleanFinalResponse
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|