diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-chromium-linux.png new file mode 100644 index 0000000000..f61b7df029 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-webkit-linux.png new file mode 100644 index 0000000000..a675eacda6 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-dark-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-chromium-linux.png new file mode 100644 index 0000000000..24fdf74e66 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-webkit-linux.png new file mode 100644 index 0000000000..66e2154222 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-CustomTooltipText-light-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-chromium-linux.png new file mode 100644 index 0000000000..f61b7df029 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-webkit-linux.png new file mode 100644 index 0000000000..a675eacda6 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-dark-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-chromium-linux.png new file mode 100644 index 0000000000..24fdf74e66 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-webkit-linux.png new file mode 100644 index 0000000000..66e2154222 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Default-light-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-chromium-linux.png new file mode 100644 index 0000000000..63dc7258a4 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-webkit-linux.png new file mode 100644 index 0000000000..014385f65e Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-dark-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-chromium-linux.png new file mode 100644 index 0000000000..2082dd7767 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-webkit-linux.png new file mode 100644 index 0000000000..2a817eaf0a Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-Size-light-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-chromium-linux.png new file mode 100644 index 0000000000..2faad65906 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-webkit-linux.png new file mode 100644 index 0000000000..caef86a7e5 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-dark-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-chromium-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-chromium-linux.png new file mode 100644 index 0000000000..19ddd5bd19 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-chromium-linux.png differ diff --git a/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-webkit-linux.png b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-webkit-linux.png new file mode 100644 index 0000000000..dd273964f4 Binary files /dev/null and b/src/components/ClipboardButton/__snapshots__/ClipboardButton.visual.test.tsx-snapshots/ClipboardButton-render-story-View-light-webkit-linux.png differ diff --git a/src/components/ClipboardButton/__stories__/ClipboardButton.stories.tsx b/src/components/ClipboardButton/__stories__/ClipboardButton.stories.tsx index 8c95e37a61..e246d1a998 100644 --- a/src/components/ClipboardButton/__stories__/ClipboardButton.stories.tsx +++ b/src/components/ClipboardButton/__stories__/ClipboardButton.stories.tsx @@ -1,9 +1,11 @@ import React from 'react'; +import {action} from '@storybook/addon-actions'; import type {Meta, StoryObj} from '@storybook/react'; import {Showcase} from '../../../demo/Showcase'; import {ShowcaseItem} from '../../../demo/ShowcaseItem'; +import type {ClipboardButtonProps} from '../ClipboardButton'; import {ClipboardButton} from '../ClipboardButton'; export default { @@ -13,7 +15,69 @@ export default { type Story = StoryObj; -export const Default: Story = {}; +export const Default: Story = { + args: { + onCopy: action('onCopy'), + onMouseEnter: action('onMouseEnter'), + onMouseLeave: action('onMouseLeave'), + onFocus: action('onFocus'), + onBlur: action('onBlur'), + }, +}; + +export const CustomTooltipText: Story = { + args: { + hasTooltip: true, + tooltipInitialText: 'Initial text', + tooltipSuccessText: 'Success text', + }, + name: 'Custom tooltip text', +}; + +export const CustomTimeout: Story = { + args: { + timeout: 5000, + }, + name: 'Custom timeout', +}; + +const viewCases: Array = [ + 'normal', + 'action', + 'outlined', + 'outlined-info', + 'outlined-success', + 'outlined-warning', + 'outlined-danger', + 'outlined-utility', + 'outlined-action', + 'raised', + 'flat', + 'flat-secondary', + 'flat-info', + 'flat-success', + 'flat-warning', + 'flat-danger', + 'flat-utility', + 'flat-action', + 'normal-contrast', + 'outlined-contrast', + 'flat-contrast', +]; + +export const View: Story = { + render: (args) => ( + + {viewCases.map((view) => { + return ( + + + + ); + })} + + ), +}; export const Size: Story = { render: (args) => ( diff --git a/src/components/ClipboardButton/__tests__/ClipboardButton.visual.test.tsx b/src/components/ClipboardButton/__tests__/ClipboardButton.visual.test.tsx new file mode 100644 index 0000000000..5fbe10ed47 --- /dev/null +++ b/src/components/ClipboardButton/__tests__/ClipboardButton.visual.test.tsx @@ -0,0 +1,33 @@ +import React from 'react'; + +import {test} from '~playwright/core'; + +import {ClipboardButtonStories} from './helpersPlaywright'; + +const mountOptions = {}; + +test.describe('ClipboardButton', () => { + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(, mountOptions); + + await expectScreenshot(); + }); + + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(, mountOptions); + + await expectScreenshot(); + }); + + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(, mountOptions); + + await expectScreenshot(); + }); + + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(, mountOptions); + + await expectScreenshot(); + }); +}); diff --git a/src/components/ClipboardButton/__tests__/helpersPlaywright.tsx b/src/components/ClipboardButton/__tests__/helpersPlaywright.tsx new file mode 100644 index 0000000000..18101e69be --- /dev/null +++ b/src/components/ClipboardButton/__tests__/helpersPlaywright.tsx @@ -0,0 +1,5 @@ +import {composeStories} from '@storybook/react'; + +import * as DefaultClipboardButtonStories from '../__stories__/ClipboardButton.stories'; + +export const ClipboardButtonStories = composeStories(DefaultClipboardButtonStories);