From d3a475d2a9717cd62eee2aeada13ac0ad925f430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Curda?= Date: Thu, 18 Jul 2024 16:05:12 +0200 Subject: [PATCH] fixup! Feat(web-react): Introduce UNSTABLE_Toggle component #DS-1346 --- .../__tests__/UNSTABLE_Toggle.test.tsx | 12 ++++++++---- .../UNSTABLE_Toggle/demo/ToggleDisabled.tsx | 2 +- .../components/UNSTABLE_Toggle/demo/ToggleFluid.tsx | 2 +- .../UNSTABLE_Toggle/demo/ToggleHelperText.tsx | 2 +- .../UNSTABLE_Toggle/demo/ToggleHiddenLabel.tsx | 2 +- .../UNSTABLE_Toggle/demo/ToggleIndicators.tsx | 2 +- .../UNSTABLE_Toggle/demo/ToggleRequired.tsx | 2 +- .../UNSTABLE_Toggle/demo/ToggleValidation.tsx | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/__tests__/UNSTABLE_Toggle.test.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/__tests__/UNSTABLE_Toggle.test.tsx index 40e1191973..6d1e057e66 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/__tests__/UNSTABLE_Toggle.test.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/__tests__/UNSTABLE_Toggle.test.tsx @@ -28,15 +28,19 @@ describe('UNSTABLE_Toggle', () => { it('should have label classname', () => { render(); - expect(screen.getByText('Toggle Label')).toHaveClass('UNSTABLE_Toggle__label'); - expect(screen.getByText('Toggle Label')).toContainHTML('label'); + const label = screen.getByText('Toggle Label'); + + expect(label).toHaveClass('UNSTABLE_Toggle__label'); + expect(label).toContainHTML('label'); }); it('should have label with required classname', () => { render(); - expect(screen.getByText('Toggle Label')).toHaveClass('UNSTABLE_Toggle__label'); - expect(screen.getByText('Toggle Label')).toHaveClass('UNSTABLE_Toggle__label--required'); + const label = screen.getByText('Toggle Label'); + + expect(label).toHaveClass('UNSTABLE_Toggle__label'); + expect(label).toHaveClass('UNSTABLE_Toggle__label--required'); }); it('should have hidden classname', () => { diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleDisabled.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleDisabled.tsx index 7a36797241..b1183a0143 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleDisabled.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleDisabled.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleDisabled = () => ( <> diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleFluid.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleFluid.tsx index c1dbd6f89d..238d23e277 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleFluid.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleFluid.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleFluid = () => ; diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHelperText.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHelperText.tsx index 8a0ecfad0e..99c01cb62d 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHelperText.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHelperText.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleHelperText = () => ( <> diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHiddenLabel.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHiddenLabel.tsx index 9146c956be..920eda882c 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHiddenLabel.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleHiddenLabel.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleHiddenLabel = () => ( diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleIndicators.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleIndicators.tsx index 89e5cd0f1d..5a3be49d6c 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleIndicators.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleIndicators.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleIndicators = () => ( <> diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleRequired.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleRequired.tsx index 255c1fe251..704a94902b 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleRequired.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleRequired.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleRequired = () => ; diff --git a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleValidation.tsx b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleValidation.tsx index 99c3478c37..f40637813a 100644 --- a/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleValidation.tsx +++ b/packages/web-react/src/components/UNSTABLE_Toggle/demo/ToggleValidation.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { UNSTABLE_Toggle } from '..'; +import UNSTABLE_Toggle from '../UNSTABLE_Toggle'; const ToggleValidation = () => ( <>