From 424fbc80234af5a004375f87cdb4d439c489d4cc Mon Sep 17 00:00:00 2001 From: Ben Howell Date: Fri, 27 Jan 2023 11:00:06 -0800 Subject: [PATCH 1/2] chore: Update Field VR tests for standalone component --- .../src/stories/Field.stories.tsx | 296 ++++++++++-------- 1 file changed, 162 insertions(+), 134 deletions(-) diff --git a/apps/vr-tests-react-components/src/stories/Field.stories.tsx b/apps/vr-tests-react-components/src/stories/Field.stories.tsx index a2c662cd535a42..b0ecd4d1b1e338 100644 --- a/apps/vr-tests-react-components/src/stories/Field.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/Field.stories.tsx @@ -1,137 +1,165 @@ import * as React from 'react'; -import { Steps, StoryWright } from 'storywright'; -import { storiesOf } from '@storybook/react'; -import { CheckboxField_unstable as CheckboxField } from '@fluentui/react-checkbox'; -import { ComboboxField_unstable as ComboboxField } from '@fluentui/react-combobox'; -import { SparkleFilled } from '@fluentui/react-icons'; -import type { InputFieldProps_unstable as InputFieldProps } from '@fluentui/react-input'; -import { InputField_unstable as InputField } from '@fluentui/react-input'; -import { ProgressField_unstable as ProgressField } from '@fluentui/react-progress'; -import { Radio, RadioGroupField_unstable as RadioGroupField } from '@fluentui/react-radio'; -import { SelectField_unstable as SelectField } from '@fluentui/react-select'; -import { SliderField_unstable as SliderField } from '@fluentui/react-slider'; -import { SpinButtonField_unstable as SpinButtonField } from '@fluentui/react-spinbutton'; -import { SwitchField_unstable as SwitchField } from '@fluentui/react-switch'; -import { TextareaField_unstable as TextareaField } from '@fluentui/react-textarea'; - -type FieldControlProps = Pick< - InputFieldProps, - 'orientation' | 'required' | 'label' | 'validationState' | 'validationMessage' | 'validationMessageIcon' | 'hint' ->; - -/** - * Common VR tests for all field components. Pass the given Field component (or a wrapper around it). - */ -const storiesOfField = (name: string, Field: React.VoidFunctionComponent) => - storiesOf(name, module) - .addDecorator(story => {story()}) - .addDecorator(story => ( -
-
- {story()} -
-
- )) - .addStory('base', () => ) - .addStory('required', () => ) - .addStory('validation', () => ( -
- - - - } - validationMessage="Custom message" - /> -
- )) - .addStory('hint', () => ) - .addStory('horizontal', () => ( - - )); - -/** - * Same as storiesOfField, but with extra stories for Field components that support the size prop. - */ -const storiesOfFieldWithSize = ( - name: string, - Field: React.VoidFunctionComponent, -) => - storiesOfField(name, Field) - .addStory('size:small', () => ) - .addStory('size:large', () => ); - -// -// CheckboxField -// -storiesOfField('CheckboxField converged', CheckboxField) - .addStory('size:large', () => ) - .addStory('fieldLabel', () => ); - -// -// ComboboxField -// -storiesOfFieldWithSize('ComboboxField converged', ComboboxField); - -// -// InputField -// -storiesOfFieldWithSize('InputField converged', InputField); -// -// ProgressField -// -storiesOfField('ProgressField converged', props => ( - -)); - -// -// RadioGroupField -// -storiesOfField('RadioGroupField converged', props => ( - - - - - -)); - -// -// SelectField -// -storiesOfFieldWithSize('SelectField converged', props => ( - - - -)); - -// -// SliderField -// -storiesOfField('SliderField converged', SliderField); - -// -// SpinButtonField -// -storiesOfField('SpinButtonField converged', SpinButtonField); - -// -// SwitchField -// -storiesOfField('SwitchField converged', SwitchField); +import { Checkbox } from '@fluentui/react-checkbox'; +import { Combobox, Dropdown } from '@fluentui/react-combobox'; +import { Field } from '@fluentui/react-field'; +import { Dismiss12Filled } from '@fluentui/react-icons'; +import { Input } from '@fluentui/react-input'; +import { ProgressBar } from '@fluentui/react-progress'; +import { Radio, RadioGroup } from '@fluentui/react-radio'; +import { Select } from '@fluentui/react-select'; +import { Slider } from '@fluentui/react-slider'; +import { SpinButton } from '@fluentui/react-spinbutton'; +import { Switch } from '@fluentui/react-switch'; +import { Textarea } from '@fluentui/react-textarea'; +import { storiesOf } from '@storybook/react'; +import { Steps, StoryWright } from 'storywright'; -// -// TextareaField -// -storiesOfFieldWithSize('TextareaField converged', TextareaField); +storiesOf('Field', module) + .addDecorator(story => ( +
+ {story()} +
+ )) + .addStory('base', () => ( + + + + )) + .addStory('required', () => ( + + + + )) + .addStory('size:small', () => ( + + + + )) + .addStory('size:large', () => ( + + + + )) + .addStory('validation:error', () => ( + + + + )) + .addStory('validation:warning', () => ( + + + + )) + .addStory('validation:success', () => ( + + + + )) + .addStory('validation:none', () => ( + + + + )) + .addStory('validationMessageIcon', () => ( + } + > + + + )) + .addStory('hint', () => ( + + + + )) + .addStory('horizontal', () => ( + + + + )) + .addStory('horizontal+longLabel', () => ( + + + + )) + .addStory('horizontal+noLabel', () => ( + + + + )) + .addStory('Checkbox:error', () => ( + + + + )) + .addStory('Combobox:error', () => ( + + + + )) + .addStory('Dropdown:error', () => ( + + + + )) + .addStory('ProgressBar:error', () => ( + + + + )) + .addStory('RadioGroup:error', () => ( + + + + + + + + )) + .addStory('Select:error', () => ( + +