From 9acdf8f461209dae53a9cf475dabbb21d30e8976 Mon Sep 17 00:00:00 2001 From: Guido Scialfa Date: Thu, 15 Feb 2024 13:16:46 +0100 Subject: [PATCH] Refactor ControlOption and improvements - Add missed `className`s properties to components - Introduce `assert` function - Improve public modules exposure - Increase code coverage --- .../client/src/components/toggle-control.tsx | 6 +- sources/client/src/index.ts | 7 +- sources/client/src/utils/assert.ts | 5 + .../convert-entities-to-control-options.ts | 15 +- .../client/src/utils/make-control-option.ts | 9 - sources/client/src/vo/control-option.ts | 22 + .../plural-select-control.test.tsx.snap | 11 + .../toggle-control.test.tsx.snap | 9 +- .../components/plural-select-control.test.tsx | 12 + .../unit/components/radio-control.test.tsx | 25 + .../singular-select-control.test.tsx | 33 +- .../unit/components/toggle-control.test.tsx | 28 + tests/client/unit/storage/reducer.test.ts | 45 + tests/client/unit/utils/assert.test.ts | 16 + .../unit/utils/make-control-option.test.ts | 13 - tests/client/unit/vo/control-option.test.ts | 23 + yarn.lock | 29203 +++++++--------- 17 files changed, 12732 insertions(+), 16750 deletions(-) create mode 100644 sources/client/src/utils/assert.ts delete mode 100644 sources/client/src/utils/make-control-option.ts create mode 100644 sources/client/src/vo/control-option.ts create mode 100644 tests/client/unit/components/__snapshots__/plural-select-control.test.tsx.snap create mode 100644 tests/client/unit/utils/assert.test.ts delete mode 100644 tests/client/unit/utils/make-control-option.test.ts create mode 100644 tests/client/unit/vo/control-option.test.ts diff --git a/sources/client/src/components/toggle-control.tsx b/sources/client/src/components/toggle-control.tsx index a88338c..e3dca70 100644 --- a/sources/client/src/components/toggle-control.tsx +++ b/sources/client/src/components/toggle-control.tsx @@ -40,11 +40,15 @@ export function ToggleControl( const value = String(option.value); const id = idByControlOption(option); return ( -
+