From a4741ee664d779dfeb2ea663149d91262a5e69f1 Mon Sep 17 00:00:00 2001 From: Dmytro Kirpa Date: Thu, 4 Jul 2024 11:49:03 +0200 Subject: [PATCH] chore(vr-tests-v9): Convert Combobox VR tests to CSF --- .../src/stories/Combobox.stories.tsx | 200 ------------------ .../src/stories/Combobox/Combobox.stories.tsx | 147 +++++++++++++ .../ComboboxOptionInteractions.stories.tsx | 134 ++++++++++++ 3 files changed, 281 insertions(+), 200 deletions(-) delete mode 100644 apps/vr-tests-react-components/src/stories/Combobox.stories.tsx create mode 100644 apps/vr-tests-react-components/src/stories/Combobox/Combobox.stories.tsx create mode 100644 apps/vr-tests-react-components/src/stories/Combobox/ComboboxOptionInteractions.stories.tsx diff --git a/apps/vr-tests-react-components/src/stories/Combobox.stories.tsx b/apps/vr-tests-react-components/src/stories/Combobox.stories.tsx deleted file mode 100644 index be6014897e6af..0000000000000 --- a/apps/vr-tests-react-components/src/stories/Combobox.stories.tsx +++ /dev/null @@ -1,200 +0,0 @@ -import * as React from 'react'; -import { Steps, StoryWright } from 'storywright'; -import { storiesOf } from '@storybook/react'; -import { Combobox, Option, OptionGroup } from '@fluentui/react-combobox'; -import { TestWrapperDecoratorFixedWidth } from '../utilities/TestWrapperDecorator'; - -storiesOf('Combobox Converged', module) - .addDecorator(TestWrapperDecoratorFixedWidth) - .addDecorator(story => ( - - {story()} - - )) - .addStory('Appearance: outline (default)', () => ( - - - - )) - .addStory('Appearance: underline', () => ( - - - - )) - .addStory('Appearance: filled-darker', () => ( -
- - - -
- )) - .addStory('Appearance: filled-lighter', () => ( -
- - - -
- )) - .addStory('Disabled', () => ( - - - - )) - .addStory('Disabled with value', () => ( - - - - )) - .addStory('Invalid: outline', () => ( - - - - )) - .addStory('Invalid: underline', () => ( - - - - )) - .addStory('Invalid: filled-darker', () => ( -
- - - -
- )) - .addStory('Invalid: filled-lighter', () => ( -
- - - -
- )) - .addStory('With placeholder', () => ( - - - - )) - .addStory('With value', () => ( - - - - )) - .addStory('Size: small', () => ( - - - - )) - .addStory('Size: large', () => ( - - - - )); - -// Option interaction stories -storiesOf('Combobox Converged', module) - .addDecorator(TestWrapperDecoratorFixedWidth) - .addDecorator(story => ( - - {story()} - - )) - .addStory('Open', () => ( -
- - - - - -
- )) - .addStory('Open with inlinePopup', () => ( -
- - - - - -
- )) - .addStory('When rendering inline, it should render on top of relatively positioned elements', () => ( -
- - - - - - -
- )) - .addStory('Option with long content', () => ( -
- - - - - -
- )) - .addStory('With selection', () => ( -
- - - - - -
- )) - .addStory('With multiselect selection', () => ( -
- - - - - -
- )) - .addStory('Disabled option', () => ( -
- - - - - -
- )) - .addStory('Open with grouped options', () => ( -
- - - - - - - - - - - - -
- )); diff --git a/apps/vr-tests-react-components/src/stories/Combobox/Combobox.stories.tsx b/apps/vr-tests-react-components/src/stories/Combobox/Combobox.stories.tsx new file mode 100644 index 0000000000000..fc2e9e8c19314 --- /dev/null +++ b/apps/vr-tests-react-components/src/stories/Combobox/Combobox.stories.tsx @@ -0,0 +1,147 @@ +import * as React from 'react'; +import { Steps, StoryWright } from 'storywright'; +import type { Meta, StoryFn } from '@storybook/react'; +import { Combobox, Option } from '@fluentui/react-combobox'; +import { TestWrapperDecoratorFixedWidth } from '../../utilities'; + +export default { + title: 'Combobox Converged', + component: Combobox, + decorators: [ + TestWrapperDecoratorFixedWidth, + story => ( + + {story()} + + ), + ], +} satisfies Meta; + +type Story = StoryFn; + +export const AppearanceOutlineDefault: Story = () => ( + + + +); + +AppearanceOutlineDefault.storyName = 'Appearance: outline (default)'; + +export const AppearanceUnderline: Story = () => ( + + + +); + +AppearanceUnderline.storyName = 'Appearance: underline'; + +export const AppearanceFilledDarker: Story = () => ( +
+ + + +
+); + +AppearanceFilledDarker.storyName = 'Appearance: filled-darker'; + +export const AppearanceFilledLighter: Story = () => ( +
+ + + +
+); + +AppearanceFilledLighter.storyName = 'Appearance: filled-lighter'; + +export const Disabled: Story = () => ( + + + +); + +export const DisabledWithValue: Story = () => ( + + + +); + +DisabledWithValue.storyName = 'Disabled with value'; + +export const InvalidOutline: Story = () => ( + + + +); + +InvalidOutline.storyName = 'Invalid: outline'; + +export const InvalidUnderline: Story = () => ( + + + +); + +InvalidUnderline.storyName = 'Invalid: underline'; + +export const InvalidFilledDarker: Story = () => ( +
+ + + +
+); + +InvalidFilledDarker.storyName = 'Invalid: filled-darker'; + +export const InvalidFilledLighter: Story = () => ( +
+ + + +
+); + +InvalidFilledLighter.storyName = 'Invalid: filled-lighter'; + +export const WithPlaceholder: Story = () => ( + + + +); + +WithPlaceholder.storyName = 'With placeholder'; + +export const WithValue: Story = () => ( + + + +); + +WithValue.storyName = 'With value'; + +export const SizeSmall: Story = () => ( + + + +); + +SizeSmall.storyName = 'Size: small'; + +export const SizeLarge: Story = () => ( + + + +); + +SizeLarge.storyName = 'Size: large'; diff --git a/apps/vr-tests-react-components/src/stories/Combobox/ComboboxOptionInteractions.stories.tsx b/apps/vr-tests-react-components/src/stories/Combobox/ComboboxOptionInteractions.stories.tsx new file mode 100644 index 0000000000000..9bd7f05de3e60 --- /dev/null +++ b/apps/vr-tests-react-components/src/stories/Combobox/ComboboxOptionInteractions.stories.tsx @@ -0,0 +1,134 @@ +import * as React from 'react'; +import { Steps, StoryWright } from 'storywright'; +import type { Meta, StoryFn } from '@storybook/react'; +import { Combobox, Option, OptionGroup } from '@fluentui/react-combobox'; +import { TestWrapperDecoratorFixedWidth } from '../../utilities'; + +export default { + title: 'Combobox Converged', + component: Combobox, + decorators: [ + TestWrapperDecoratorFixedWidth, + story => ( + + {story()} + + ), + ], +} satisfies Meta; + +type Story = StoryFn; + +export const Open: Story = () => ( +
+ + + + + +
+); + +export const OpenWithInlinePopup: Story = () => ( +
+ + + + + +
+); + +OpenWithInlinePopup.storyName = 'Open with inlinePopup'; + +export const WhenRenderingInlineItShouldRenderOnTopOfRelativelyPositionedElements: Story = () => ( +
+ + + + + + +
+); + +WhenRenderingInlineItShouldRenderOnTopOfRelativelyPositionedElements.storyName = + 'When rendering inline, it should render on top of relatively positioned elements'; + +export const OptionWithLongContent: Story = () => ( +
+ + + + + +
+); + +OptionWithLongContent.storyName = 'Option with long content'; + +export const WithSelection: Story = () => ( +
+ + + + + +
+); + +WithSelection.storyName = 'With selection'; + +export const WithMultiselectSelection: Story = () => ( +
+ + + + + +
+); + +WithMultiselectSelection.storyName = 'With multiselect selection'; + +export const DisabledOption: Story = () => ( +
+ + + + + +
+); + +DisabledOption.storyName = 'Disabled option'; + +export const OpenWithGroupedOptions: Story = () => ( +
+ + + + + + + + + + + + +
+); + +OpenWithGroupedOptions.storyName = 'Open with grouped options';