diff --git a/src/components/Text/__stories__/Text.stories.tsx b/src/components/Text/__stories__/Text.stories.tsx index 8c7d2e5ff2..f79eb836ed 100644 --- a/src/components/Text/__stories__/Text.stories.tsx +++ b/src/components/Text/__stories__/Text.stories.tsx @@ -2,6 +2,8 @@ import React from 'react'; import type {Meta, StoryObj} from '@storybook/react'; +import {Button} from '../../Button'; +import {TextInput} from '../../controls'; import {Flex} from '../../layout'; import {Text, colorText, text} from '../index'; @@ -101,3 +103,45 @@ export const WordBreak: Story = { wordBreak: 'break-all', }, }; + +const LabelWithControlledFocusStory = () => { + const ref = React.useRef(null); // don't delete this ref - needed to check currect react html type inshurance + const id = 'some-id'; + + return ( + + + Click on label to control text input + + + + ); +}; + +export const LabelWithControlledFocus: Story = { + render: () => , + + args: {}, +}; + +const WithCustomElementRenderStory = () => { + return ( + + + { + 'Hello World!' + } + + + + Hello World! + + + ); +}; + +export const WithCustomElementRender: Story = { + render: () => , + + args: {}, +}; diff --git a/src/components/Text/__tests__/Text.test.tsx b/src/components/Text/__tests__/Text.test.tsx deleted file mode 100644 index ca93be8b14..0000000000 --- a/src/components/Text/__tests__/Text.test.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; - -import {render} from '../../../../test-utils/utils'; -import {Button} from '../../Button'; -import {Text} from '../Text'; - -describe('Text', () => { - describe('should return expected html', () => { - test('if no props passed', () => { - const {container} = render(Hello World!); - - expect(container).toMatchSnapshot(); - }); - - test('if qa attr passed and variant changed', () => { - const {container} = render( - - Hello World! - , - ); - - expect(container).toMatchSnapshot(); - }); - - test('if html attributes passed and changed default html tag and with typed ref', () => { - const ComponentWithRef = () => { - const ref = React.useRef(null); - - return ( - - Hello World! - - ); - }; - - const {container} = render(); - - expect(container).toMatchSnapshot(); - }); - - test('if passed props what converted to classNames and styles', () => { - const {container} = render( - - Hello World! - , - ); - - expect(container).toMatchSnapshot(); - }); - - test('with another component substitution', () => { - const {container} = render( - - Hello World! - , - ); - - expect(container).toMatchSnapshot(); - }); - }); -}); diff --git a/src/components/Text/__tests__/__snapshots__/Text.test.tsx.snap b/src/components/Text/__tests__/__snapshots__/Text.test.tsx.snap deleted file mode 100644 index d8d2075752..0000000000 --- a/src/components/Text/__tests__/__snapshots__/Text.test.tsx.snap +++ /dev/null @@ -1,59 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Text should return expected html if html attributes passed and changed default html tag and with typed ref 1`] = ` -
- -
-`; - -exports[`Text should return expected html if no props passed 1`] = ` -
- - Hello World! - -
-`; - -exports[`Text should return expected html if passed props what converted to classNames and styles 1`] = ` -
- - Hello World! - -
-`; - -exports[`Text should return expected html if qa attr passed and variant changed 1`] = ` -
- - Hello World! - -
-`; - -exports[`Text should return expected html with another component substitution 1`] = ` -
- -
-`;