From 6c9328fbf3117a86c61eecfa5d972f021f1cc33a Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Tue, 4 Jun 2019 11:22:05 -0700 Subject: [PATCH] @storybook/html: add support for stories generated by dom elements (#35947) --- types/storybook__html/index.d.ts | 2 +- types/storybook__html/storybook__html-tests.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/storybook__html/index.d.ts b/types/storybook__html/index.d.ts index 6af9ba5592..633c1279b0 100644 --- a/types/storybook__html/index.d.ts +++ b/types/storybook__html/index.d.ts @@ -6,7 +6,7 @@ /// -export type RenderFunction = () => string | string[]; +export type RenderFunction = () => string | string[] | HTMLElement; export interface DecoratorParameters { [key: string]: any; diff --git a/types/storybook__html/storybook__html-tests.ts b/types/storybook__html/storybook__html-tests.ts index 57c7625e9e..00ecb78e69 100644 --- a/types/storybook__html/storybook__html-tests.ts +++ b/types/storybook__html/storybook__html-tests.ts @@ -33,6 +33,11 @@ storiesOf('withAnyAddon', module) .addWithSideEffect('more', () => "
") .add('another story', () => "
") .add('to Storybook as Array', () => ["
", "
"]) + .add('storybook with dom', () => { + const button = document.createElement('button'); + button.innerText = '😀 😎 👍 💯'; + return button; + }) .add('and a story with additional parameters', () => "
", parameters) .addWithSideEffect('even more', () => "
");