From f9011ac3d4c4d032511e6f52cd464facb22251c6 Mon Sep 17 00:00:00 2001 From: Rik Claessens Date: Sat, 13 Jul 2024 14:07:54 +0200 Subject: [PATCH] Wrap storybook components for SearchBar and SearchBarAutocomplete in wrapInTestApp Signed-off-by: Rik Claessens --- .../SearchAutocomplete.stories.tsx | 23 ++++++++-------- .../SearchBar/SearchBar.stories.tsx | 26 +++++++++++-------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/plugins/search-react/src/components/SearchAutocomplete/SearchAutocomplete.stories.tsx b/plugins/search-react/src/components/SearchAutocomplete/SearchAutocomplete.stories.tsx index eb113cb5fd..57f0c01f39 100644 --- a/plugins/search-react/src/components/SearchAutocomplete/SearchAutocomplete.stories.tsx +++ b/plugins/search-react/src/components/SearchAutocomplete/SearchAutocomplete.stories.tsx @@ -19,7 +19,7 @@ import React, { ComponentType, PropsWithChildren } from 'react'; import Grid from '@material-ui/core/Grid'; import LabelIcon from '@material-ui/icons/Label'; -import { TestApiProvider } from '@backstage/test-utils'; +import { TestApiProvider, wrapInTestApp } from '@backstage/test-utils'; import { searchApiRef, MockSearchApi } from '../../api'; import { SearchContextProvider } from '../../context'; @@ -31,17 +31,18 @@ export default { title: 'Plugins/Search/SearchAutocomplete', component: SearchAutocomplete, decorators: [ - (Story: ComponentType>) => ( - - - - - + (Story: ComponentType>) => + wrapInTestApp( + + + + + + - - - - ), + + , + ), ], }; diff --git a/plugins/search-react/src/components/SearchBar/SearchBar.stories.tsx b/plugins/search-react/src/components/SearchBar/SearchBar.stories.tsx index 852a3a1881..7bbd75d3f3 100644 --- a/plugins/search-react/src/components/SearchBar/SearchBar.stories.tsx +++ b/plugins/search-react/src/components/SearchBar/SearchBar.stories.tsx @@ -18,7 +18,7 @@ import React, { ComponentType, PropsWithChildren } from 'react'; import Grid from '@material-ui/core/Grid'; import { makeStyles } from '@material-ui/core/styles'; -import { TestApiProvider } from '@backstage/test-utils'; +import { TestApiProvider, wrapInTestApp } from '@backstage/test-utils'; import { searchApiRef, MockSearchApi } from '../../api'; import { SearchContextProvider } from '../../context'; @@ -28,18 +28,22 @@ import { SearchBar } from './SearchBar'; export default { title: 'Plugins/Search/SearchBar', component: SearchBar, + loaders: [ + async () => ({ component: (await import('./SearchBar')).SearchBar }), + ], decorators: [ - (Story: ComponentType>) => ( - - - - - + (Story: ComponentType>) => + wrapInTestApp( + + + + + + - - - - ), + + , + ), ], };