From 6ce580e3363e1477cdf29c365cf37d8de0fd9409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 24 Feb 2021 13:42:29 +0100 Subject: [PATCH] Supply an app context in storybook plugin test --- .../core/src/layout/Page/Page.stories.tsx | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/packages/core/src/layout/Page/Page.stories.tsx b/packages/core/src/layout/Page/Page.stories.tsx index 1fdaf8eced..79d9fa5d72 100644 --- a/packages/core/src/layout/Page/Page.stories.tsx +++ b/packages/core/src/layout/Page/Page.stories.tsx @@ -26,6 +26,7 @@ import { InfoCard, Page, } from '../'; +import { createApp } from '../../api-wrappers'; import { GaugeCard, StatusOK, @@ -192,46 +193,53 @@ const ExampleContentHeader = ({ selectedTab }: { selectedTab?: number }) => ( ); +const app = createApp({ configLoader: async () => [] }); +const AppProvider = app.getProvider(); + export const PluginWithData = () => { const [selectedTab, setSelectedTab] = useState(2); return ( - -
- - - setSelectedTab(index)} - tabs={tabs.map(({ label }, index) => ({ - id: index.toString(), - label, - }))} - /> - - - - - -
-
+ + +
+ + + setSelectedTab(index)} + tabs={tabs.map(({ label }, index) => ({ + id: index.toString(), + label, + }))} + /> + + + + + +
+
+
); }; export const PluginWithTable = () => { return ( -
- - - - - - - - + +
+ + + + +
+ + + + ); };