-
-
{story()}
+/**
+ * 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 => (
+
-
- ))
- .addStory('base', () =>
)
- .addStory('required', () =>
)
- .addStory('validation:error', () =>
)
- .addStory('validation:warning', () =>
)
- .addStory('validation:success', () =>
)
- .addStory('validation:custom', () => (
-
} validationMessage="Custom message" />
- ))
- .addStory('hint', () =>
)
- .addStory('horizontal', () =>
)
- .addStory('horizontal+label:multiline', () => (
-
- ))
- .addStory('horizontal+validation:error+hint', () => (
-
- ))
- .addStory('size:small', () => (
-
-
-
-
- Option
-
-
-
-
-
- ))
- .addStory('size:large', () => (
-
-
-
-
-
- Option
-
-
-
- ))
- .addStory('CheckboxField+fieldLabel', () => (
-
- ));
+ ))
+ .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 => (
+
+ Option one
+
+));
+
+//
+// SliderField
+//
+storiesOfField('SliderField converged', SliderField);
+
+//
+// SpinButtonField
+//
+storiesOfField('SpinButtonField converged', SpinButtonField);
+
+//
+// SwitchField
+//
+storiesOfField('SwitchField converged', SwitchField);
+
+//
+// TextareaField
+//
+storiesOfFieldWithSize('TextareaField converged', TextareaField);