From 1027e215a2b816e6871370c776b2d97d8eb43ed5 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 15 Oct 2019 17:46:19 +0200 Subject: [PATCH] Fix stories --- .../MultiAutocompleteSelectField.stories.tsx | 8 +- .../SingleAutocompleteSelectField.stories.tsx | 9 +- .../__snapshots__/Stories.test.ts.snap | 1988 +++++++++++++---- 3 files changed, 1520 insertions(+), 485 deletions(-) diff --git a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx index 0beab562e..533326c51 100644 --- a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx +++ b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx @@ -32,7 +32,7 @@ const Story: React.FC< enableLoadMore: boolean; } > -> = storyProps => { +> = ({ allowCustomValues, enableLoadMore }) => { const { change, data: countries } = useMultiAutocomplete([suggestions[0]]); return ( @@ -49,9 +49,9 @@ const Story: React.FC< onChange={event => change(event, choices)} value={countries.map(country => country.value)} loading={loading} - hasMore={storyProps.enableLoadMore ? hasMore : false} - onFetchMore={storyProps.enableLoadMore ? fetchMore : undefined} - {...storyProps} + hasMore={enableLoadMore ? hasMore : false} + onFetchMore={enableLoadMore ? fetchMore : undefined} + allowCustomValues={allowCustomValues} /> )} diff --git a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx index 4ce6428e8..1d8468f30 100644 --- a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx +++ b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx @@ -33,7 +33,7 @@ const Story: React.FC< enableLoadMore: boolean; } > -> = storyProps => { +> = ({ allowCustomValues, emptyOption, enableLoadMore }) => { const [displayValue, setDisplayValue] = React.useState(suggestions[0].label); return ( @@ -57,9 +57,10 @@ const Story: React.FC< loading={loading} onChange={handleSelect} value={data.country} - hasMore={storyProps.enableLoadMore ? hasMore : false} - onFetchMore={storyProps.enableLoadMore ? fetchMore : undefined} - {...storyProps} + hasMore={enableLoadMore ? hasMore : false} + onFetchMore={enableLoadMore ? fetchMore : undefined} + allowCustomValues={allowCustomValues} + emptyOption={emptyOption} /> ); }} diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index afe0e6323..7f8731f37 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -497,7 +497,7 @@ exports[`Storyshots Generics / AddressFormatter default 1`] = ` >
`; -exports[`Storyshots Generics / MultiAutocompleteSelectField with custom option 1`] = ` -
-
-
-
-
- - -

- Value: Afghanistan -

-
-
-
-
-
-

- Afghanistan -

- -
-
-
-
-
-
-`; - -exports[`Storyshots Generics / MultiAutocompleteSelectField with loaded data 1`] = ` -
-
-
-
-
- - -

- Value: Afghanistan -

-
-
-
-
-
-

- Afghanistan -

- -
-
-
-
-
-
-`; - -exports[`Storyshots Generics / MultiAutocompleteSelectField with loading data 1`] = ` -
-
-
-
-
- - -

- Value: Afghanistan -

-
-
-
-
-
-

- Afghanistan -

- -
-
-
-
-
-
-`; - exports[`Storyshots Generics / MultiSelectField interactive 1`] = `
`; +exports[`Storyshots Generics / Multiple select with autocomplete can load more 1`] = ` +
+
+
+
+
+ +
+ + + + + + + + + + +
+
+
+ + + +
+
+
+
+
+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Multiple select with autocomplete default 1`] = ` +
+
+
+
+
+ +
+ + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Multiple select with autocomplete interactive 1`] = ` +
+
+
+
+
+ + +

+ Value: AF +

+
+
+
+
+
+

+ Afghanistan +

+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Multiple select with autocomplete interactive with custom option 1`] = ` +
+
+
+
+
+ + +

+ Value: AF +

+
+
+
+
+
+

+ Afghanistan +

+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Multiple select with autocomplete interactive with load more 1`] = ` +
+
+
+
+
+ + +

+ Value: AF +

+
+
+
+
+
+

+ Afghanistan +

+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Multiple select with autocomplete no data 1`] = ` +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+`; + exports[`Storyshots Generics / PageHeader with title 1`] = `
`; -exports[`Storyshots Generics / SingleAutocompleteSelectField with custom option 1`] = ` +exports[`Storyshots Generics / Select with autocomplete can load more 1`] = `
+
+
+
+ + + + + + + + + + +
+
+
+ + + +
+
+
+
+
+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Select with autocomplete default 1`] = ` +
+
+
+
+
+ + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Select with autocomplete interactive 1`] = ` +
+
- Value: afghanistan + Value: AF

@@ -3811,13 +4729,13 @@ exports[`Storyshots Generics / SingleAutocompleteSelectField with custom option
`; -exports[`Storyshots Generics / SingleAutocompleteSelectField with loaded data 1`] = ` +exports[`Storyshots Generics / Select with autocomplete interactive with custom option 1`] = `
- Value: afghanistan + Value: AF

@@ -3894,13 +4812,13 @@ exports[`Storyshots Generics / SingleAutocompleteSelectField with loaded data 1`
`; -exports[`Storyshots Generics / SingleAutocompleteSelectField with loading data 1`] = ` +exports[`Storyshots Generics / Select with autocomplete interactive with empty option 1`] = `
- + +

- Value: afghanistan + Value: AF

@@ -3981,13 +4895,139 @@ exports[`Storyshots Generics / SingleAutocompleteSelectField with loading data 1
`; +exports[`Storyshots Generics / Select with autocomplete interactive with load more 1`] = ` +
+
+
+
+
+
+ + +

+ Value: AF +

+
+
+
+
+
+
+`; + +exports[`Storyshots Generics / Select with autocomplete no data 1`] = ` +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+`; + exports[`Storyshots Generics / SingleSelectField with error hint 1`] = `
`; -exports[`Storyshots Orders / OrderCustomerEditDialog default 1`] = ` -
-`; - exports[`Storyshots Orders / OrderDraftCancelDialog default 1`] = `