Skip to content

Commit

Permalink
test(Button): add 'render custom Icon size' test (#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
teleginzhenya authored Mar 28, 2024
1 parent b0b3ec8 commit f031d13
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 6 deletions.
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.
8 changes: 7 additions & 1 deletion src/components/Button/__tests__/Button.visual.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import {test} from '~playwright/core';

import {ButtonStories} from './helpersPlaywright';
import {ButtonStories, CustomIconSizeButton} from './helpersPlaywright';

test.describe('Button', () => {
test('render story: <Default>', async ({mount, expectScreenshot}) => {
Expand Down Expand Up @@ -70,4 +70,10 @@ test.describe('Button', () => {

await expectScreenshot();
});

test('render custom Icon size', async ({mount, expectScreenshot}) => {
await mount(<CustomIconSizeButton />);

await expectScreenshot();
});
});
5 changes: 0 additions & 5 deletions src/components/Button/__tests__/helpersPlaywright.ts

This file was deleted.

41 changes: 41 additions & 0 deletions src/components/Button/__tests__/helpersPlaywright.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';

import {ChevronDown, Globe} from '@gravity-ui/icons';
import {composeStories} from '@storybook/react';

import {Button} from '..';
import {Showcase} from '../../../demo/Showcase';
import {Icon} from '../../Icon';
import * as DefaultButtonStories from '../__stories__/Button.stories';

export const ButtonStories = composeStories(DefaultButtonStories);

export const CustomIconSizeButton = () => (
<Showcase>
<Button size="xs">
<Icon size={16} data={Globe} />
Both bigger icons
<Icon size={16} data={ChevronDown} />
</Button>
<Button size="s">
<Icon size={20} data={Globe} />
Both bigger icons
<Icon size={20} data={ChevronDown} />
</Button>
<Button size="m">
<Icon size={20} data={Globe} />
Both bigger icons
<Icon size={20} data={ChevronDown} />
</Button>
<Button size="l">
<Icon size={20} data={Globe} />
Both bigger icons
<Icon size={20} data={ChevronDown} />
</Button>
<Button size="xl">
<Icon size={24} data={Globe} />
Both bigger icons
<Icon size={24} data={ChevronDown} />
</Button>
</Showcase>
);

0 comments on commit f031d13

Please sign in to comment.