Skip to content

Commit

Permalink
test(TabbarItem): add screenshots tests to component (#7477)
Browse files Browse the repository at this point in the history
  • Loading branch information
EldarMuhamethanov authored Aug 29, 2024
1 parent 0f5391d commit c48038f
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Icon28MessageOutline } from '@vkontakte/icons';
import { ComponentPlayground, type ComponentPlaygroundProps } from '@vkui-e2e/playground-helpers';
import { Badge } from '../Badge/Badge';
import { Tabbar, type TabbarProps } from '../Tabbar/Tabbar';
import { TabbarItem, type TabbarItemProps } from './TabbarItem';

export const TabbarItemPlayground = (playgroundProps: ComponentPlaygroundProps) => {
return (
<ComponentPlayground
{...playgroundProps}
propSets={[
{
mode: ['vertical', 'horizontal'],
text: ['Message'],
children: [<Icon28MessageOutline key="icon" />],
indicator: [undefined, <Badge key="badge" />],
disabled: [false, true],
},
{
mode: ['horizontal'],
text: ['Message'],
children: [<Icon28MessageOutline key="icon" />],
selected: [true, false],
},
]}
>
{(props: TabbarItemProps & Pick<TabbarProps, 'mode'>) => (
<Tabbar mode={props.mode} style={{ position: 'relative' }}>
<TabbarItem {...props} />
</Tabbar>
)}
</ComponentPlayground>
);
};
13 changes: 13 additions & 0 deletions packages/vkui/src/components/TabbarItem/TabbarItem.e2e.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test } from '@vkui-e2e/test';
import { TabbarItemPlayground } from './TabbarItem.e2e-playground';

test.use({ onlyForPlatforms: ['android', 'ios'] });

test('TabbarItem', async ({
mount,
expectScreenshotClippedToContent,
componentPlaygroundProps,
}) => {
await mount(<TabbarItemPlayground {...componentPlaygroundProps} />);
await expectScreenshotClippedToContent();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c48038f

Please sign in to comment.