Skip to content

Commit

Permalink
fix(Text): remove tests and add new stories
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaevAlexandr committed May 21, 2024
1 parent a543034 commit 90b9863
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 126 deletions.
44 changes: 44 additions & 0 deletions src/components/Text/__stories__/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -101,3 +103,45 @@ export const WordBreak: Story = {
wordBreak: 'break-all',
},
};

const LabelWithControlledFocusStory = () => {
const ref = React.useRef<HTMLLabelElement>(null); // don't delete this ref - needed to check currect react html type inshurance
const id = 'some-id';

return (
<Flex gap="5">
<Text as="label" htmlFor={id} ref={ref}>
Click on label to control text input
</Text>
<TextInput id={id} />
</Flex>
);
};

export const LabelWithControlledFocus: Story = {
render: () => <LabelWithControlledFocusStory />,

args: {},
};

const WithCustomElementRenderStory = () => {
return (
<Flex direction={'column'} gap="5">
<Text as="code">
{
'<Text as={Button} size={\'m\'} view="action" color="danger-heavy" variant="header-1">Hello World!</Text>'
}
</Text>

<Text as={Button} size={'m'} view="action" color="danger-heavy" variant="header-1">
Hello World!
</Text>
</Flex>
);
};

export const WithCustomElementRender: Story = {
render: () => <WithCustomElementRenderStory />,

args: {},
};
67 changes: 0 additions & 67 deletions src/components/Text/__tests__/Text.test.tsx

This file was deleted.

59 changes: 0 additions & 59 deletions src/components/Text/__tests__/__snapshots__/Text.test.tsx.snap

This file was deleted.

0 comments on commit 90b9863

Please sign in to comment.