( - -)); +export default { + title: 'Async', + includeStories: ['withTimeout'], +}; + +export const withTimeout = () => ; +withTimeout.story = { + name: `with ${TIMEOUT}ms timeout simulating async operation`, +}; diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/Button.stories.js b/addons/storyshots/storyshots-core/stories/required_with_context/Button.stories.js index 6dbfd97a1cdd..1fc8a7b33e07 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/Button.stories.js +++ b/addons/storyshots/storyshots-core/stories/required_with_context/Button.stories.js @@ -1,18 +1,26 @@ import React from 'react'; -import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { Button } from '@storybook/react/demo'; -storiesOf('Button', module) - .addParameters({ +export default { + title: 'Button', + + parameters: { component: Button, - }) - .add('with text', () => Hello Button) - .add('with some emoji', () => ( - - - ๐ ๐ ๐ ๐ฏ - - - )); + }, +}; + +export const withText = () => Hello Button; + +export const withSomeEmoji = () => ( + + + ๐ ๐ ๐ ๐ฏ + + +); + +withSomeEmoji.story = { + name: 'with some emoji', +}; diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/Welcome.stories.js b/addons/storyshots/storyshots-core/stories/required_with_context/Welcome.stories.js index abd9b87b39b4..df42de0bc96f 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/Welcome.stories.js +++ b/addons/storyshots/storyshots-core/stories/required_with_context/Welcome.stories.js @@ -1,11 +1,18 @@ import React from 'react'; -import { storiesOf } from '@storybook/react'; import { linkTo } from '@storybook/addon-links'; import { Welcome } from '@storybook/react/demo'; -storiesOf('Welcome', module) - .addParameters({ +export default { + title: 'Welcome', + + parameters: { component: Welcome, - }) - .add('to Storybook', () => ); + }, +}; + +export const toStorybook = () => ; + +toStorybook.story = { + name: 'to Storybook', +}; diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.async.storyshot b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.async.storyshot index bb2f1c611268..2b0ad426c6cd 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.async.storyshot +++ b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.async.storyshot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots Async with 5ms timeout simulating async operation 1`] = ` +exports[`Storyshots Async With Timeout 1`] = ` THIS IS SO DONE diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.foo b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.foo index d4459afef802..63102b6aa4f4 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.foo +++ b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.foo @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots Async with 5ms timeout simulating async operation 1`] = ` +exports[`Storyshots Async With Timeout 1`] = ` diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.storyshot b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.storyshot index d4459afef802..63102b6aa4f4 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.storyshot +++ b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Async.stories.storyshot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots Async with 5ms timeout simulating async operation 1`] = ` +exports[`Storyshots Async With Timeout 1`] = ` diff --git a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Button.stories.foo b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Button.stories.foo index 68d7d468c5d1..0c782e5eb37f 100644 --- a/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Button.stories.foo +++ b/addons/storyshots/storyshots-core/stories/required_with_context/__snapshots__/Button.stories.foo @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots Button with some emoji 1`] = ` +exports[`Storyshots Button With Some Emoji 1`] = ` `; -exports[`Storyshots Button with text 1`] = ` +exports[`Storyshots Button With Text 1`] = ` `; -exports[`Storyshots Button with text 1`] = ` +exports[`Storyshots Button With Text 1`] = ` `; + +exports[`Storyshots Addons|a11y Disabled 1`] = ` + + Testing the a11y addon + +`; + +exports[`Storyshots Addons|a11y Label 1`] = ` + + Testing the a11y addon + +`; + +exports[`Storyshots Addons|a11y Story 4 1`] = ` + + Testing the a11y addon + +`; + +exports[`Storyshots Addons|a11y Story 5 1`] = ``; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-actions.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-actions.stories.storyshot new file mode 100644 index 000000000000..e60f715f988e --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-actions.stories.storyshot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Actions Story 1 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 2 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 3 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 4 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 5 1`] = ` + + +`; + +exports[`Storyshots Addons|Actions Story 6 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 7 1`] = ` + + Hello World + +`; + +exports[`Storyshots Addons|Actions Story 8 1`] = ` + + Hello World + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-backgrounds.stories.storyshot new file mode 100644 index 000000000000..c6683463f0e3 --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Backgrounds Story 1 1`] = ` + + You should be able to switch backgrounds for this story + +`; + +exports[`Storyshots Addons|Backgrounds Story 2 1`] = ` + + This one too! + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-centered.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-centered.stories.storyshot new file mode 100644 index 000000000000..1d660b4925c0 --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-centered.stories.storyshot @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Centered Story 1 1`] = ` + + + + I am a Button ! + + + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-events.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-events.stories.storyshot new file mode 100644 index 000000000000..6887b83c61bd --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-events.stories.storyshot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Events Logger 1`] = ` + + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-jest.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-jest.stories.storyshot new file mode 100644 index 000000000000..346b24a26337 --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-jest.stories.storyshot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Jest With Tests 1`] = `This story shows test results`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-knobs.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-knobs.stories.storyshot new file mode 100644 index 000000000000..b0680c2196b7 --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-knobs.stories.storyshot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Knobs DOM 1`] = ` + + John Doe + +`; + +exports[`Storyshots Addons|Knobs Simple 1`] = ` + + I am John Doe and I'm 44 years old. + +`; + +exports[`Storyshots Addons|Knobs Story 3 1`] = ` + + John Doe + +`; + +exports[`Storyshots Addons|Knobs Story 4 1`] = ` + + + + + My name is Jane, + + + + + today is January 20, 2017 + + + + + I have a stock of 20 apples, costing $2.25 each. + + + + + Also, I have: + + + + + + Laptop + + + Book + + + Whiskey + + + + + + Nice to meet you! + + + + +`; + +exports[`Storyshots Addons|Knobs Story 5 1`] = `<img src=x onerror="alert('XSS Attack')" >`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot new file mode 100644 index 000000000000..7267fb23a7fb --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Notes Story 1 1`] = ` + + + + + + This is a fragment of HTML + + + + + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/button.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/button.stories.storyshot new file mode 100644 index 000000000000..629692365089 --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/button.stories.storyshot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Demo Button 1`] = ` + + Hello Button + +`; + +exports[`Storyshots Demo Effect 1`] = ` + + I should be yellow + +`; + +exports[`Storyshots Demo Heading 1`] = ` + + Hello World + +`; + +exports[`Storyshots Demo Headings 1`] = ` + + + Hello World + + + Hello World + + + Hello World + + + Hello World + + +`; diff --git a/examples/html-kitchen-sink/stories/__snapshots__/welcome.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/welcome.stories.storyshot new file mode 100644 index 000000000000..8b68425a1eaf --- /dev/null +++ b/examples/html-kitchen-sink/stories/__snapshots__/welcome.stories.storyshot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Welcome Welcome 1`] = ` + + + + + Welcome to Storybook for HTML + + + + + This is a UI component dev environment for your plain HTML snippets. + + + + + + We've added some basic stories inside the + + stories + + directory. + + + + A story is a single state of one or more UI components. You can have as many stories as you want. + + + + (Basically a story is like a visual test case.) + + + + + + + See these sample + + stories + + + + + + + + + + + + + + Just like that, you can add your own snippets as stories. + + + + You can also edit those snippets and see changes right away. + + + + + + + + + + Usually we create stories with smaller UI components in the app. + + + Have a look at the + + + + Writing Stories + + + + section in our documentation. + + + + + +`; diff --git a/examples/html-kitchen-sink/tests/__snapshots__/htmlshots.test.js.snap b/examples/html-kitchen-sink/tests/__snapshots__/htmlshots.test.js.snap deleted file mode 100644 index b5409d3afc18..000000000000 --- a/examples/html-kitchen-sink/tests/__snapshots__/htmlshots.test.js.snap +++ /dev/null @@ -1,347 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots Addons|Actions Story 1 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 2 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 3 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 4 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 5 1`] = ` - - -`; - -exports[`Storyshots Addons|Actions Story 6 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 7 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Actions Story 8 1`] = ` - - Hello World - -`; - -exports[`Storyshots Addons|Backgrounds Story 1 1`] = ` - - You should be able to switch backgrounds for this story - -`; - -exports[`Storyshots Addons|Backgrounds Story 2 1`] = ` - - This one too! - -`; - -exports[`Storyshots Addons|Centered Story 1 1`] = ` - - - - I am a Button ! - - - -`; - -exports[`Storyshots Addons|Events Logger 1`] = ` - - -`; - -exports[`Storyshots Addons|Jest With Tests 1`] = `This story shows test results`; - -exports[`Storyshots Addons|Knobs DOM 1`] = ` - - John Doe - -`; - -exports[`Storyshots Addons|Knobs Simple 1`] = ` - - I am John Doe and I'm 44 years old. - -`; - -exports[`Storyshots Addons|Knobs Story 3 1`] = ` - - John Doe - -`; - -exports[`Storyshots Addons|Knobs Story 4 1`] = ` - - - - - My name is Jane, - - - - - today is January 20, 2017 - - - - - I have a stock of 20 apples, costing $2.25 each. - - - - - Also, I have: - - - - - - Laptop - - - Book - - - Whiskey - - - - - - Nice to meet you! - - - - -`; - -exports[`Storyshots Addons|Knobs Story 5 1`] = `<img src=x onerror="alert('XSS Attack')" >`; - -exports[`Storyshots Addons|Notes Story 1 1`] = ` - - - - - - This is a fragment of HTML - - - - - -`; - -exports[`Storyshots Addons|a11y Default 1`] = ``; - -exports[`Storyshots Addons|a11y Disabled 1`] = ` - - Testing the a11y addon - -`; - -exports[`Storyshots Addons|a11y Label 1`] = ` - - Testing the a11y addon - -`; - -exports[`Storyshots Addons|a11y Story 4 1`] = ` - - Testing the a11y addon - -`; - -exports[`Storyshots Addons|a11y Story 5 1`] = ``; - -exports[`Storyshots Demo Button 1`] = ` - - Hello Button - -`; - -exports[`Storyshots Demo Effect 1`] = ` - - I should be yellow - -`; - -exports[`Storyshots Demo Heading 1`] = ` - - Hello World - -`; - -exports[`Storyshots Demo Headings 1`] = ` - - - Hello World - - - Hello World - - - Hello World - - - Hello World - - -`; - -exports[`Storyshots Welcome Welcome 1`] = ` - - - - - Welcome to Storybook for HTML - - - - - This is a UI component dev environment for your plain HTML snippets. - - - - - - We've added some basic stories inside the - - stories - - directory. - - - - A story is a single state of one or more UI components. You can have as many stories as you want. - - - - (Basically a story is like a visual test case.) - - - - - - - See these sample - - stories - - - - - - - - - - - - - - Just like that, you can add your own snippets as stories. - - - - You can also edit those snippets and see changes right away. - - - - - - - - - - Usually we create stories with smaller UI components in the app. - - - Have a look at the - - - - Writing Stories - - - - section in our documentation. - - - - - -`; diff --git a/examples/official-storybook/stories/core/parameters.stories.js b/examples/official-storybook/stories/core/parameters.stories.js index 5e327839fb3a..c1ac1a0a35ec 100644 --- a/examples/official-storybook/stories/core/parameters.stories.js +++ b/examples/official-storybook/stories/core/parameters.stories.js @@ -19,7 +19,7 @@ export default { // I'm not sure what we should recommend regarding propTypes? are they a good idea for examples? // Given we sort of control the props, should we export a prop type? -export const passed = ({ parameters: { options, ...parameters }, ...rest }) => ( +export const passed = ({ parameters: { options, fileName, ...parameters }, ...rest }) => ( Parameters: {JSON.stringify(parameters, null, 2)} ); passed.story = { diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot new file mode 100644 index 000000000000..21711980741b --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Actions Action And Method 1`] = ` + + Click me to log the action + +`; + +exports[`Storyshots Addons|Actions Action Only 1`] = ` + + Click me to log the action + +`; + +exports[`Storyshots Addons|Actions Multiple Actions 1`] = ` + + (Double) click me to log the action + +`; + +exports[`Storyshots Addons|Actions Multiple Actions Object 1`] = ` + + (Double) click me to log the action + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot new file mode 100644 index 000000000000..82a8e7a135eb --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Backgrounds Example 1 1`] = ` + + You should be able to switch backgrounds for this story + +`; + +exports[`Storyshots Addons|Backgrounds Example 2 1`] = ` + + This one too! + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot new file mode 100644 index 000000000000..433db7c4e984 --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot @@ -0,0 +1,54 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Centered Button 1`] = ` +Object { + "__b": 0, + "__c": null, + "__e": null, + "__k": null, + "__p": null, + "constructor": undefined, + "key": undefined, + "l": null, + "props": Object { + "children": Object { + "__b": 0, + "__c": null, + "__e": null, + "__k": null, + "__p": null, + "constructor": undefined, + "key": undefined, + "l": null, + "props": Object { + "children": VNode { + "attributes": undefined, + "children": Array [ + "A button", + ], + "key": undefined, + "nodeName": [Function], + }, + "style": Object { + "margin": "auto", + "maxHeight": "100%", + }, + }, + "ref": undefined, + "type": "div", + }, + "style": Object { + "alignItems": "center", + "bottom": "0", + "display": "flex", + "left": "0", + "overflow": "auto", + "position": "fixed", + "right": "0", + "top": "0", + }, + }, + "ref": undefined, + "type": "div", +} +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot new file mode 100644 index 000000000000..1dfa7eee48ca --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Contexts Simple Css Theming 1`] = ` + + + I'm a children of the injected 'div' (where provides a theming context). + + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot new file mode 100644 index 000000000000..6f1aca47f895 --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Knobs All Knobs 1`] = ` + + + My name is Jane, + + + today is January 20, 2017 + + + I have a stock of 20 apples, costing $2.25 each. + + + Also, I have: + + + + Laptop + + + Book + + + Whiskey + + + + Nice to meet you! + + +`; + +exports[`Storyshots Addons|Knobs Simple 1`] = ` + + I am John Doe and I'm 44 years old. + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot new file mode 100644 index 000000000000..f32979111aa4 --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Links Go To Welcome 1`] = ` + + This button links to Welcome + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot new file mode 100644 index 000000000000..9518657476b1 --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addons|Notes Note With Html 1`] = ` + + + ๐ค๐ณ๐ฏ๐ฎ + + + + ๐๐ฉ๐๐ฑ + + + + ๐ค๐๐ถ๐ + + +`; + +exports[`Storyshots Addons|Notes Simple Note 1`] = ` + + + Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna. + + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot new file mode 100644 index 000000000000..65fc9911048c --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Button With Some Emoji 1`] = ` + + + ๐ ๐ ๐ ๐ฏ + + +`; + +exports[`Storyshots Button With Text 1`] = ` + + Hello Button + +`; diff --git a/examples/preact-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot b/examples/preact-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot new file mode 100644 index 000000000000..337a8e9b02a5 --- /dev/null +++ b/examples/preact-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot @@ -0,0 +1,186 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Welcome To Storybook 1`] = ` + + + Welcome to storybook for Preact + + + + This is a UI component dev environment for your Preact app. + + + We've added some basic stories inside the + + src/stories + + directory. + + A story is a single state of one or more UI components. You can have as many stories as you want. + + (Basically a story is like a visual test case.) + + + See these sample + + stories + + for a component calledย + + Button + + . + + + Just like that, you can add your own components as stories. + + You can also edit those components and see changes right away. + + (Try editing the + + Button + + stories located atย + + src/stories/index.js + + .) + + + Usually we create stories with smaller UI components in the app. + + Have a look at theย + + Writing Stories + + ย section in our documentation. + + + + NOTE: + + + Have a look at the + + .storybook/webpack.config.js + + to add webpack loaders and plugins you are using in this project. + + +`; diff --git a/examples/riot-kitchen-sink/__snapshots__/riotshots.test.js.snap b/examples/riot-kitchen-sink/__snapshots__/riotshots.test.js.snap deleted file mode 100644 index 3fb6742a95e7..000000000000 --- a/examples/riot-kitchen-sink/__snapshots__/riotshots.test.js.snap +++ /dev/null @@ -1,372 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots Addon|Actions Action Only 1`] = ` - - - Click me to log the action! - - -`; - -exports[`Storyshots Addon|Actions Multiple Actions 1`] = ` - - - Double Click me to log the action! - - -`; - -exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` - - - - You should be able to switch backgrounds for this story! - - - -`; - -exports[`Storyshots Addon|Backgrounds Story 2 1`] = ` - - - - This one too!! - - - -`; - -exports[`Storyshots Addon|Knobs All Knobs 1`] = ` - - - - - - My name is Jane, - - - - today is January 20, 2017 - - - - I have a stock of 20 apples, costing $2.25 each. - - - - Also, I have: - - - - - - Laptop - - - Book - - - Whiskey - - - - - - Nice to meet you! - - - - - -`; - -exports[`Storyshots Addon|Knobs Simple 1`] = ` - - - I am John Doe and I'm 44 years old. - - -`; - -exports[`Storyshots Addon|Knobs Xss Safety 1`] = ` - - - <img src=x onerror="alert('XSS Attack')" > - - -`; - -exports[`Storyshots Addon|Links Go To Welcome 1`] = ` - - - This button links to Welcome! - - -`; - -exports[`Storyshots Addon|Notes Note With Html 1`] = ` - - - - ๐ค๐ณ๐ฏ๐ฎ - - ๐๐ฉ๐๐ฑ - - ๐ค๐๐ถ๐ - - - -`; - -exports[`Storyshots Addon|Notes Simple Note 1`] = ` - - - - Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna. - - - -`; - -exports[`Storyshots Core|Parameters Passed To Story 1`] = ` - - - Parameters are {"options":{"hierarchyRootSeparator":{},"hierarchySeparator":{}},"docs":{},"globalParameter":"globalParameter","framework":"riot","chapterParameter":"chapterParameter","displayName":"passed to story","storyParameter":"storyParameter","id":"root","dataIs":"parameters"} - - -`; - -exports[`Storyshots Story|How to create a story Built As String 1`] = ` - - - - simple test - - - -`; - -exports[`Storyshots Story|How to create a story Built From Raw Import 1`] = ` - - - simple test (without parameter). Oh, by the way (... well, nothing) - - -`; - -exports[`Storyshots Story|How to create a story Built From Tags And Template 1`] = ` - - - - simple test (with a parameter). Oh, by the way (value is mapped to riotValue) - - - -`; - -exports[`Storyshots Story|How to create a story Built From The Precompilation 1`] = ` - - - yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) - - -`; - -exports[`Storyshots Story|How to create a story Built With Tag 1`] = ` - - - simple test (with a parameter) - - -`; - -exports[`Storyshots Story|How to create a story Tags Template And Tag Constructor At Once 1`] = ` - - - - HACKED : true ; simple test (with a parameter). Oh, by the way (value is mapped to riotValue) - - - -`; - -exports[`Storyshots Story|How to create a story The Mount Instruction Is Not Necessary 1`] = ` - - - yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) - - -`; - -exports[`Storyshots Story|How to create a story The Opts Value Is Not Necessary 1`] = ` - - - yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) - - -`; - -exports[`Storyshots Story|Nest tags Matriochka 1`] = ` - - - - - - Inside tag1: - - - - - Inside tag2: - - - - - Inside tag3: - - - - - Inside tag4: - - - - - Inside tag5: - - - Content - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Storyshots Story|Nest tags Three Tags 1`] = ` - - - - - Simple title - - - - - Simple Content - - - - -`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot new file mode 100644 index 000000000000..dfdfc9a794f7 --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Actions Action Only 1`] = ` + + + Click me to log the action! + + +`; + +exports[`Storyshots Addon|Actions Multiple Actions 1`] = ` + + + Double Click me to log the action! + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot new file mode 100644 index 000000000000..3890194d5a6d --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` + + + + You should be able to switch backgrounds for this story! + + + +`; + +exports[`Storyshots Addon|Backgrounds Story 2 1`] = ` + + + + This one too!! + + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot new file mode 100644 index 000000000000..5048bb099070 --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot @@ -0,0 +1,78 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Knobs All Knobs 1`] = ` + + + + + + My name is Jane, + + + + today is January 20, 2017 + + + + I have a stock of 20 apples, costing $2.25 each. + + + + Also, I have: + + + + + + Laptop + + + Book + + + Whiskey + + + + + + Nice to meet you! + + + + + +`; + +exports[`Storyshots Addon|Knobs Simple 1`] = ` + + + I am John Doe and I'm 44 years old. + + +`; + +exports[`Storyshots Addon|Knobs Xss Safety 1`] = ` + + + <img src=x onerror="alert('XSS Attack')" > + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot new file mode 100644 index 000000000000..3ea40775c3c6 --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Links Go To Welcome 1`] = ` + + + This button links to Welcome! + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot new file mode 100644 index 000000000000..89cff014aed0 --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Notes Note With Html 1`] = ` + + + + ๐ค๐ณ๐ฏ๐ฎ + + ๐๐ฉ๐๐ฑ + + ๐ค๐๐ถ๐ + + + +`; + +exports[`Storyshots Addon|Notes Simple Note 1`] = ` + + + + Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna. + + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot new file mode 100644 index 000000000000..b38cd6df3ffc --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Core|Parameters Passed To Story 1`] = ` + + + Parameters are {"options":{"hierarchyRootSeparator":{},"hierarchySeparator":{}},"docs":{},"globalParameter":"globalParameter","framework":"riot","chapterParameter":"chapterParameter","displayName":"passed to story","storyParameter":"storyParameter","id":"root","dataIs":"parameters"} + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/nested-tags.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/nested-tags.stories.storyshot new file mode 100644 index 000000000000..5840eda50c94 --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/nested-tags.stories.storyshot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Story|Nest tags Matriochka 1`] = ` + + + + + + Inside tag1: + + + + + Inside tag2: + + + + + Inside tag3: + + + + + Inside tag4: + + + + + Inside tag5: + + + Content + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Storyshots Story|Nest tags Three Tags 1`] = ` + + + + + Simple title + + + + + Simple Content + + + + +`; diff --git a/examples/riot-kitchen-sink/src/stories/__snapshots__/story-code.stories.storyshot b/examples/riot-kitchen-sink/src/stories/__snapshots__/story-code.stories.storyshot new file mode 100644 index 000000000000..4215e96a32bf --- /dev/null +++ b/examples/riot-kitchen-sink/src/stories/__snapshots__/story-code.stories.storyshot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Story|How to create a story Built As String 1`] = ` + + + + simple test + + + +`; + +exports[`Storyshots Story|How to create a story Built From Raw Import 1`] = ` + + + simple test (without parameter). Oh, by the way (... well, nothing) + + +`; + +exports[`Storyshots Story|How to create a story Built From Tags And Template 1`] = ` + + + + simple test (with a parameter). Oh, by the way (value is mapped to riotValue) + + + +`; + +exports[`Storyshots Story|How to create a story Built From The Precompilation 1`] = ` + + + yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) + + +`; + +exports[`Storyshots Story|How to create a story Built With Tag 1`] = ` + + + simple test (with a parameter) + + +`; + +exports[`Storyshots Story|How to create a story Tags Template And Tag Constructor At Once 1`] = ` + + + + HACKED : true ; simple test (with a parameter). Oh, by the way (value is mapped to riotValue) + + + +`; + +exports[`Storyshots Story|How to create a story The Mount Instruction Is Not Necessary 1`] = ` + + + yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) + + +`; + +exports[`Storyshots Story|How to create a story The Opts Value Is Not Necessary 1`] = ` + + + yet another test, precompiled this time (WARN, only works in lower case, never upper case with precompiled templates) + + +`; diff --git a/examples/svelte-kitchen-sink/__snapshots__/svelteshots.test.js.snap b/examples/svelte-kitchen-sink/__snapshots__/svelteshots.test.js.snap deleted file mode 100644 index 1e1b083a99ca..000000000000 --- a/examples/svelte-kitchen-sink/__snapshots__/svelteshots.test.js.snap +++ /dev/null @@ -1,462 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots Addon|Actions Action On Component Method 1`] = ` - - - - Round - corners - - - - Custom text - - - -`; - -exports[`Storyshots Addon|Actions Action On View Method 1`] = ` - - - Button view - - - - - Square - corners - - - - - - You clicked - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` - - - Button view - - - - - Square - corners - - - - - - You clicked - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Addon|Centered Rounded 1`] = ` - - - - Round - corners - - - - Look, I'm centered! - - - -`; - -exports[`Storyshots Addon|Centered With Action 1`] = ` - - - - Round - corners - - - - - - - -`; - -exports[`Storyshots Addon|Knobs Simple 1`] = ` - - - - I am interactive - - - -`; - -exports[`Storyshots Addon|Links Go To Welcome View 1`] = ` - - - - Link Action - - - - - Return to the - - Welcome - - view story. - - - - -`; - -exports[`Storyshots Addon|Notes Note With Html 1`] = ` - - - Button view - - - - - Square - corners - - - - - - ๐ค๐ณ๐ฏ๐ฎ๐๐ฉ๐๐ฑ๐ค๐๐ถ๐ - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Addon|Notes Simple Note 1`] = ` - - - Button view - - - - - Square - corners - - - - - - You clicked - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Button Rounded 1`] = ` - - - Button view - - - - - Round - corners - - - - - - You clicked - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Button Square 1`] = ` - - - Button view - - - - - Square - corners - - - - - - You clicked - : - 0 - - - - A little text to show this is a view. - - - - If we need to test components in a Svelte environment, for instance to test slot behaviour, - - - - then wrapping the component up in a view - - - - made just for the story is the simplest way to achieve this. - - -`; - -exports[`Storyshots Welcome Welcome 1`] = ` - - - - Welcome to Storybook for Svelte - - - - - This is a UI component dev environment for your svelte app. - - - - - - We've added some basic stories inside the - - src/stories - - directory. - - - A story is like a visual test case - - - and represents a single state of one or more UI components. - You can have as many stories as you want. - - - - - Svelte - - - - - Just like that, you can add your own components as stories. - You can also edit those components and see changes right away. - - - - (Try editing the - - Button - - component - located at - - src/stories/views/Welcome.svelte - - .) - - - - - - Usually we create stories with smaller UI components in the app. - - - Have a look at the - - - Writing Stories - - - section in our documentation. - - - - - - NOTE: - - - - - Have a look at the - - - .storybook/webpack.config.js - - - to add webpack - loaders and plugins you are using in this project. - - - - -`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot new file mode 100644 index 000000000000..9b5efd72cf15 --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Actions Action On Component Method 1`] = ` + + + + Round + corners + + + + Custom text + + + +`; + +exports[`Storyshots Addon|Actions Action On View Method 1`] = ` + + + Button view + + + + + Square + corners + + + + + + You clicked + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot new file mode 100644 index 000000000000..7b2908e40df0 --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` + + + Button view + + + + + Square + corners + + + + + + You clicked + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot new file mode 100644 index 000000000000..bc142e951d50 --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Centered Rounded 1`] = ` + + + + Round + corners + + + + Look, I'm centered! + + + +`; + +exports[`Storyshots Addon|Centered With Action 1`] = ` + + + + Round + corners + + + + + + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot new file mode 100644 index 000000000000..9ad2c1cc73db --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Knobs Simple 1`] = ` + + + + I am interactive + + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot new file mode 100644 index 000000000000..06f5abb524be --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Links Go To Welcome View 1`] = ` + + + + Link Action + + + + + Return to the + + Welcome + + view story. + + + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot new file mode 100644 index 000000000000..9b3c5d81db4e --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot @@ -0,0 +1,85 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Notes Note With Html 1`] = ` + + + Button view + + + + + Square + corners + + + + + + ๐ค๐ณ๐ฏ๐ฎ๐๐ฉ๐๐ฑ๐ค๐๐ถ๐ + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; + +exports[`Storyshots Addon|Notes Simple Note 1`] = ` + + + Button view + + + + + Square + corners + + + + + + You clicked + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot new file mode 100644 index 000000000000..a4075e3a5962 --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/button.stories.storyshot @@ -0,0 +1,85 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Button Rounded 1`] = ` + + + Button view + + + + + Round + corners + + + + + + You clicked + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; + +exports[`Storyshots Button Square 1`] = ` + + + Button view + + + + + Square + corners + + + + + + You clicked + : + 0 + + + + A little text to show this is a view. + + + + If we need to test components in a Svelte environment, for instance to test slot behaviour, + + + + then wrapping the component up in a view + + + + made just for the story is the simplest way to achieve this. + + +`; diff --git a/examples/svelte-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot b/examples/svelte-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot new file mode 100644 index 000000000000..afa7cf1e09df --- /dev/null +++ b/examples/svelte-kitchen-sink/src/stories/__snapshots__/welcome.stories.storyshot @@ -0,0 +1,111 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Welcome Welcome 1`] = ` + + + + Welcome to Storybook for Svelte + + + + + This is a UI component dev environment for your svelte app. + + + + + + We've added some basic stories inside the + + src/stories + + directory. + + + A story is like a visual test case + + + and represents a single state of one or more UI components. + You can have as many stories as you want. + + + + + Svelte + + + + + Just like that, you can add your own components as stories. + You can also edit those components and see changes right away. + + + + (Try editing the + + Button + + component + located at + + src/stories/views/Welcome.svelte + + .) + + + + + + Usually we create stories with smaller UI components in the app. + + + Have a look at the + + + Writing Stories + + + section in our documentation. + + + + + + NOTE: + + + + + Have a look at the + + + .storybook/webpack.config.js + + + to add webpack + loaders and plugins you are using in this project. + + + + +`; diff --git a/examples/vue-kitchen-sink/__snapshots__/vueshots.test.js.snap b/examples/vue-kitchen-sink/__snapshots__/vueshots.test.js.snap deleted file mode 100644 index 494e638e51c7..000000000000 --- a/examples/vue-kitchen-sink/__snapshots__/vueshots.test.js.snap +++ /dev/null @@ -1,596 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots Addon|Actions Action And Method 1`] = ` - - Click me to log the action! - -`; - -exports[`Storyshots Addon|Actions Action Only 1`] = ` - - Click me to log the action! - -`; - -exports[`Storyshots Addon|Actions Multiple Actions 1`] = ` - - (Double) click me to log the action! - -`; - -exports[`Storyshots Addon|Actions Multiple Actions Object 1`] = ` - - (Double) click me to log the action! - -`; - -exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` - - You should be able to switch backgrounds for this story - -`; - -exports[`Storyshots Addon|Backgrounds Story 2 1`] = ` - - This one too! - -`; - -exports[`Storyshots Addon|Centered Rounded 1`] = ` - - - - A Button with rounded edges! - - - -`; - -exports[`Storyshots Addon|Contexts Languages 1`] = ` - - - - Your locale is unknown, so I say NULL! - - - -`; - -exports[`Storyshots Addon|Contexts Simple Css Theming 1`] = ` - - - I'm a children of the injected 'div' (where provides a theming context). - - -`; - -exports[`Storyshots Addon|Knobs All Knobs 1`] = ` - - - My name is Jane, - - - - today is January 20, 2017 - - - - I have a stock of 20 apples, costing $2.25 each. - - - - Also, I have: - - - - - Laptop - - - Book - - - Whiskey - - - - - Nice to meet you! - - -`; - -exports[`Storyshots Addon|Knobs Simple 1`] = ` - - I am John Doe and I'm 40 years old. - -`; - -exports[`Storyshots Addon|Knobs Xss Safety 1`] = ` - - <img src=x onerror="alert('XSS Attack')" > - -`; - -exports[`Storyshots Addon|Links Go To Welcome 1`] = ` - - This buttons links to Welcome! - -`; - -exports[`Storyshots Addon|Notes Note With Html 1`] = ` - - ๐ค๐ณ๐ฏ๐ฎ - - ๐๐ฉ๐๐ฑ - - ๐ค๐๐ถ๐ - -`; - -exports[`Storyshots Addon|Notes Simple Note 1`] = ` - - - Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna. - - -`; - -exports[`Storyshots App App 1`] = ` - - - - - - - Essential Links - - - - - - Core Docs - - - - - - Forum - - - - - - Gitter Chat - - - - - - Twitter - - - - - - Ecosystem - - - - - - vue-router - - - - - - vuex - - - - - - vue-loader - - - - - - awesome-vue - - - - -`; - -exports[`Storyshots Button Rounded 1`] = ` - - A Button with rounded edges! - -`; - -exports[`Storyshots Button Square 1`] = ` - - A Button with square edges! - -`; - -exports[`Storyshots Core|Errors Null Error 1`] = ``; - -exports[`Storyshots Core|Parameters Passed To Story 1`] = ` - - Parameters are {"options":{"hierarchyRootSeparator":{},"hierarchySeparator":{}},"docs":{"iframeHeight":"60px"},"globalParameter":"globalParameter","framework":"vue","chapterParameter":"chapterParameter","storyParameter":"storyParameter","displayName":"passed to story"} - -`; - -exports[`Storyshots Core|Template String Only 1`] = ` - - A Button with square edges! - -`; - -exports[`Storyshots Custom|Decorator for Vue Render 1`] = ` - - - - renders component: MyButton! - - - -`; - -exports[`Storyshots Custom|Decorator for Vue Template 1`] = ` - - - - MyButton with template! - - - -`; - -exports[`Storyshots Custom|Decorator for Vue With Data 1`] = ` - - - - { - "id": "custom-decorator-for-vue--with-data", - "kind": "Custom|Decorator for Vue", - "name": "With Data", - "story": "With Data", - "customContext": 52, - "parameters": { - "options": { - "hierarchyRootSeparator": {}, - "hierarchySeparator": {} - }, - "docs": { - "iframeHeight": "60px" - }, - "globalParameter": "globalParameter", - "framework": "vue", - "customParameter": 42 - } -} - - - -`; - -exports[`Storyshots Custom|Method for rendering Vue JSX 1`] = ` - - MyButton rendered with JSX! - -`; - -exports[`Storyshots Custom|Method for rendering Vue Pre Registered Component 1`] = ` - - - This component was pre-registered in .storybook/config.js - - - - - MyButton rendered in a template! - - -`; - -exports[`Storyshots Custom|Method for rendering Vue Render 1`] = ` - - renders a div with some text in it.. - -`; - -exports[`Storyshots Custom|Method for rendering Vue Render Component 1`] = ` - - renders component: MyButton! - -`; - -exports[`Storyshots Custom|Method for rendering Vue Template 1`] = ` - - - A template - - - - rendered in vue in storybook - - -`; - -exports[`Storyshots Custom|Method for rendering Vue Template Component 1`] = ` - - MyButton rendered in a template! - -`; - -exports[`Storyshots Custom|Method for rendering Vue Template Methods 1`] = ` - - - Clicking the button will navigate to another story using the 'addon-links' - - - - - MyButton rendered in a template + props & methods! - - -`; - -exports[`Storyshots Custom|Method for rendering Vue Vuex Actions 1`] = ` - - with vuex: 0! - -`; - -exports[`Storyshots Custom|Method for rendering Vue Whatever You Want 1`] = ` - - with awesomeness: 0! - -`; - -exports[`Storyshots Welcome Welcome 1`] = ` - - - Welcome to Storybook for Vue - - - - - This is a UI component dev environment for your vue app. - - - - - - We've added some basic stories inside the - - - src/stories - - - directory. - - - - A story is a single state of one or more UI components. - You can have as many stories as you want. - - - - (Basically a story is like a visual test case.) - - - - - - See these sample - - - stories - - - for a component called - - - Button - - - . - - - - - - - - - - Just like that, you can add your own components as stories. - - - - You can also edit those components and see changes right away. - - - - (Try editing the - - Button - - component - located at - - src/stories/Button.js - - .) - - - - - - Usually we create stories with smaller UI components in the app. - - - Have a look at the - - - - Writing Stories - - - - section in our documentation. - - - - - - NOTE: - - - - - Have a look at the - - - .storybook/webpack.config.js - - - to add webpack - loaders and plugins you are using in this project. - - - -`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot new file mode 100644 index 000000000000..a8e39c6d1dab --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-actions.stories.storyshot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Actions Action And Method 1`] = ` + + Click me to log the action! + +`; + +exports[`Storyshots Addon|Actions Action Only 1`] = ` + + Click me to log the action! + +`; + +exports[`Storyshots Addon|Actions Multiple Actions 1`] = ` + + (Double) click me to log the action! + +`; + +exports[`Storyshots Addon|Actions Multiple Actions Object 1`] = ` + + (Double) click me to log the action! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot new file mode 100644 index 000000000000..d61093a32752 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-backgrounds.stories.storyshot @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Backgrounds Story 1 1`] = ` + + You should be able to switch backgrounds for this story + +`; + +exports[`Storyshots Addon|Backgrounds Story 2 1`] = ` + + This one too! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot new file mode 100644 index 000000000000..9ea9c883b13d --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-centered.stories.storyshot @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Centered Rounded 1`] = ` + + + + A Button with rounded edges! + + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot new file mode 100644 index 000000000000..e151e361c930 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-contexts.stories.storyshot @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Contexts Languages 1`] = ` + + + + Your locale is unknown, so I say NULL! + + + +`; + +exports[`Storyshots Addon|Contexts Simple Css Theming 1`] = ` + + + I'm a children of the injected 'div' (where provides a theming context). + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot new file mode 100644 index 000000000000..7ebaa7fdb908 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-knobs.stories.storyshot @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Knobs All Knobs 1`] = ` + + + My name is Jane, + + + + today is January 20, 2017 + + + + I have a stock of 20 apples, costing $2.25 each. + + + + Also, I have: + + + + + Laptop + + + Book + + + Whiskey + + + + + Nice to meet you! + + +`; + +exports[`Storyshots Addon|Knobs Simple 1`] = ` + + I am John Doe and I'm 40 years old. + +`; + +exports[`Storyshots Addon|Knobs Xss Safety 1`] = ` + + <img src=x onerror="alert('XSS Attack')" > + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot new file mode 100644 index 000000000000..97a0a4857665 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Links Go To Welcome 1`] = ` + + This buttons links to Welcome! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot new file mode 100644 index 000000000000..ee44b67c5650 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/addon-notes.stories.storyshot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Addon|Notes Note With Html 1`] = ` + + ๐ค๐ณ๐ฏ๐ฎ + + ๐๐ฉ๐๐ฑ + + ๐ค๐๐ถ๐ + +`; + +exports[`Storyshots Addon|Notes Simple Note 1`] = ` + + + Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna. + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/core-errors.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/core-errors.stories.storyshot new file mode 100644 index 000000000000..d68a8ab769c4 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/core-errors.stories.storyshot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Core|Errors Null Error 1`] = ``; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/core-template.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/core-template.stories.storyshot new file mode 100644 index 000000000000..e1a310af8558 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/core-template.stories.storyshot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Core|Template String Only 1`] = ` + + A Button with square edges! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot new file mode 100644 index 000000000000..0f3b9843dbc2 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/core.stories.storyshot @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Core|Parameters Passed To Story 1`] = ` + + Parameters are {"options":{"hierarchyRootSeparator":{},"hierarchySeparator":{}},"docs":{"iframeHeight":"60px"},"globalParameter":"globalParameter","framework":"vue","chapterParameter":"chapterParameter","storyParameter":"storyParameter","displayName":"passed to story"} + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-decorators.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-decorators.stories.storyshot new file mode 100644 index 000000000000..f7ff2ea1852e --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-decorators.stories.storyshot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Custom|Decorator for Vue Render 1`] = ` + + + + renders component: MyButton! + + + +`; + +exports[`Storyshots Custom|Decorator for Vue Template 1`] = ` + + + + MyButton with template! + + + +`; + +exports[`Storyshots Custom|Decorator for Vue With Data 1`] = ` + + + + { + "id": "custom-decorator-for-vue--with-data", + "kind": "Custom|Decorator for Vue", + "name": "With Data", + "story": "With Data", + "parameters": { + "options": { + "hierarchyRootSeparator": {}, + "hierarchySeparator": {} + }, + "docs": { + "iframeHeight": "60px" + }, + "globalParameter": "globalParameter", + "framework": "vue", + "customParameter": 42 + }, + "customContext": 52 +} + + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-rendering.stories.storyshot b/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-rendering.stories.storyshot new file mode 100644 index 000000000000..109e8129d4f1 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/__snapshots__/custom-rendering.stories.storyshot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Custom|Method for rendering Vue JSX 1`] = ` + + MyButton rendered with JSX! + +`; + +exports[`Storyshots Custom|Method for rendering Vue Pre Registered Component 1`] = ` + + + This component was pre-registered in .storybook/config.js + + + + + MyButton rendered in a template! + + +`; + +exports[`Storyshots Custom|Method for rendering Vue Render 1`] = ` + + renders a div with some text in it.. + +`; + +exports[`Storyshots Custom|Method for rendering Vue Render Component 1`] = ` + + renders component: MyButton! + +`; + +exports[`Storyshots Custom|Method for rendering Vue Template 1`] = ` + + + A template + + + + rendered in vue in storybook + + +`; + +exports[`Storyshots Custom|Method for rendering Vue Template Component 1`] = ` + + MyButton rendered in a template! + +`; + +exports[`Storyshots Custom|Method for rendering Vue Template Methods 1`] = ` + + + Clicking the button will navigate to another story using the 'addon-links' + + + + + MyButton rendered in a template + props & methods! + + +`; + +exports[`Storyshots Custom|Method for rendering Vue Vuex Actions 1`] = ` + + with vuex: 0! + +`; + +exports[`Storyshots Custom|Method for rendering Vue Whatever You Want 1`] = ` + + with awesomeness: 0! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/components/__snapshots__/app.stories.storyshot b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/app.stories.storyshot new file mode 100644 index 000000000000..2b30c7b21146 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/app.stories.storyshot @@ -0,0 +1,97 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots App App 1`] = ` + + + + + + + Essential Links + + + + + + Core Docs + + + + + + Forum + + + + + + Gitter Chat + + + + + + Twitter + + + + + + Ecosystem + + + + + + vue-router + + + + + + vuex + + + + + + vue-loader + + + + + + awesome-vue + + + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/components/__snapshots__/button.stories.storyshot b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/button.stories.storyshot new file mode 100644 index 000000000000..1c59fe0ea820 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/button.stories.storyshot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Button Rounded 1`] = ` + + A Button with rounded edges! + +`; + +exports[`Storyshots Button Square 1`] = ` + + A Button with square edges! + +`; diff --git a/examples/vue-kitchen-sink/src/stories/components/__snapshots__/welcome.stories.storyshot b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/welcome.stories.storyshot new file mode 100644 index 000000000000..0122e0d93143 --- /dev/null +++ b/examples/vue-kitchen-sink/src/stories/components/__snapshots__/welcome.stories.storyshot @@ -0,0 +1,140 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Welcome Welcome 1`] = ` + + + Welcome to Storybook for Vue + + + + + This is a UI component dev environment for your vue app. + + + + + + We've added some basic stories inside the + + + src/stories + + + directory. + + + + A story is a single state of one or more UI components. + You can have as many stories as you want. + + + + (Basically a story is like a visual test case.) + + + + + + See these sample + + + stories + + + for a component called + + + Button + + + . + + + + + + + + + + Just like that, you can add your own components as stories. + + + + You can also edit those components and see changes right away. + + + + (Try editing the + + Button + + component + located at + + src/stories/Button.js + + .) + + + + + + Usually we create stories with smaller UI components in the app. + + + Have a look at the + + + + Writing Stories + + + + section in our documentation. + + + + + + NOTE: + + + + + Have a look at the + + + .storybook/webpack.config.js + + + to add webpack + loaders and plugins you are using in this project. + + + +`; diff --git a/examples/vue-kitchen-sink/src/stories/custom-decorators.stories.js b/examples/vue-kitchen-sink/src/stories/custom-decorators.stories.js index 208c02fda237..2920b2a2cd67 100644 --- a/examples/vue-kitchen-sink/src/stories/custom-decorators.stories.js +++ b/examples/vue-kitchen-sink/src/stories/custom-decorators.stories.js @@ -30,7 +30,7 @@ export const template = () => ({ template: 'MyButton with template', }); -export const withData = ({ parameters, hooks, ...rest }) => ({ +export const withData = ({ parameters: { fileName, ...parameters }, hooks, ...rest }) => ({ template: `${JSON.stringify({ ...rest, parameters }, null, 2)}`, }); diff --git a/jest.config.js b/jest.config.js index 139bc97ae3b9..505606e2925e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -41,8 +41,8 @@ module.exports = { '/examples/official-storybook', ], transform: { - '^.+\\.jsx?$': '/scripts/babel-jest.js', - '^.+\\.tsx?$': '/scripts/babel-jest.js', + '^.+\\.stories\\.[jt]sx?$': '@storybook/addon-storyshots/injectFileName', + '^.+\\.[jt]sx?$': '/scripts/babel-jest.js', }, testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], testPathIgnorePatterns: [ diff --git a/lib/core/src/client/preview/start.js b/lib/core/src/client/preview/start.js index 6a5e53563a6e..444eee567a8d 100644 --- a/lib/core/src/client/preview/start.js +++ b/lib/core/src/client/preview/start.js @@ -334,7 +334,7 @@ export default function start(render, { decorateStory } = {}) { window.__STORYBOOK_ADDONS_CHANNEL__ = channel; // may not be defined } - let previousExports = new Set(); + let previousExports = new Map(); const loadStories = (loadable, framework) => () => { // Make sure we don't try to define a kind more than once within the same load const loadedKinds = new Set(); @@ -346,18 +346,21 @@ export default function start(render, { decorateStory } = {}) { reqs = [loadable]; } - let currentExports = new Set(); + let currentExports = new Map(); if (reqs) { reqs.forEach(req => { req.keys().forEach(filename => { const fileExports = req(filename); - currentExports.add(fileExports); + currentExports.set( + fileExports, + typeof req.resolve === 'function' ? req.resolve(filename) : null + ); }); }); } else { const exported = loadable(); if (Array.isArray(exported) && !exported.find(obj => !obj.default)) { - currentExports = new Set(exported); + currentExports = new Map(exported.map(fileExports => [fileExports, null])); } else if (exported) { logger.warn( `Loader function passed to 'configure' should return void or an array of module exports that all contain a 'default' export. Received: ${JSON.stringify( @@ -367,7 +370,7 @@ export default function start(render, { decorateStory } = {}) { } } - const removed = [...previousExports].filter(exp => !currentExports.has(exp)); + const removed = [...previousExports.keys()].filter(exp => !currentExports.has(exp)); removed.forEach(exp => { if (exp.default) { storyStore.removeStoryKind(exp.default.title); @@ -377,7 +380,7 @@ export default function start(render, { decorateStory } = {}) { storyStore.incrementRevision(); } - const added = [...currentExports].filter(exp => !previousExports.has(exp)); + const added = [...currentExports.keys()].filter(exp => !previousExports.has(exp)); added.forEach(fileExports => { // An old-style story file if (!fileExports.default) { @@ -404,7 +407,12 @@ export default function start(render, { decorateStory } = {}) { const kind = clientApi.storiesOf(kindName, true); // we should always have a framework, rest optional - kind.addParameters({ framework, component, ...params }); + kind.addParameters({ + framework, + component, + fileName: currentExports.get(fileExports), + ...params, + }); (decos || []).forEach(decorator => { kind.addDecorator(decorator); @@ -443,7 +451,7 @@ export default function start(render, { decorateStory } = {}) { */ const configure = (loadable, m, framework) => { if (m && m.hot && m.hot.dispose) { - ({ previousExports = new Set() } = m.hot.data || {}); + ({ previousExports = new Map() } = m.hot.data || {}); m.hot.dispose(data => { loaded = false; diff --git a/yarn.lock b/yarn.lock index d3bbb2b07358..d39ca74f9cad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2382,6 +2382,15 @@ chalk "^2.0.1" slash "^2.0.0" +"@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + "@jest/core@^24.8.0": version "24.8.0" resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" @@ -2434,6 +2443,15 @@ jest-message-util "^24.8.0" jest-mock "^24.8.0" +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + "@jest/reporters@^24.8.0": version "24.8.0" resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" @@ -2470,6 +2488,15 @@ graceful-fs "^4.1.15" source-map "^0.6.0" +"@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + "@jest/test-result@^24.8.0": version "24.8.0" resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" @@ -2479,6 +2506,15 @@ "@jest/types" "^24.8.0" "@types/istanbul-lib-coverage" "^2.0.0" +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/istanbul-lib-coverage" "^2.0.0" + "@jest/test-sequencer@^24.8.0": version "24.8.0" resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" @@ -2510,6 +2546,28 @@ source-map "^0.6.1" write-file-atomic "2.4.1" +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.9.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" + micromatch "^3.1.10" + pirates "^4.0.1" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + "@jest/types@^24.7.0", "@jest/types@^24.8.0": version "24.8.0" resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" @@ -2519,6 +2577,15 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^12.0.9" +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + "@lasso/marko-taglib@^1.0.13": version "1.0.15" resolved "https://registry.yarnpkg.com/@lasso/marko-taglib/-/marko-taglib-1.0.15.tgz#c0076ce265d9cbb2c2f84adb5c8101fcac6118a8" @@ -4339,11 +4406,23 @@ resolved "https://registry.yarnpkg.com/@types/websql/-/websql-0.0.27.tgz#621a666a7f02018e7cbb4abab956a25736c27d71" integrity sha1-Yhpman8CAY58u0q6uVaiVzbCfXE= +"@types/yargs-parser@*": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== + "@types/yargs@^12.0.2", "@types/yargs@^12.0.9": version "12.0.12" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== +"@types/yargs@^13.0.0": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.2.tgz#a64674fc0149574ecd90ba746e932b5a5f7b3653" + integrity sha512-lwwgizwk/bIIU+3ELORkyuOgDjCh7zuWDFqRtPPhhVgq9N1F7CvLNKg1TX4f2duwtKQ0p044Au9r1PLIXHrIzQ== + dependencies: + "@types/yargs-parser" "*" + "@typescript-eslint/eslint-plugin@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.6.0.tgz#a5ff3128c692393fb16efa403ec7c8a5593dab0f" @@ -16830,6 +16909,25 @@ jest-haste-map@^24.8.0: optionalDependencies: fsevents "^1.2.7" +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== + dependencies: + "@jest/types" "^24.9.0" + anymatch "^2.0.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" + micromatch "^3.1.10" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" + jest-image-snapshot@^2.8.2: version "2.9.0" resolved "https://registry.yarnpkg.com/jest-image-snapshot/-/jest-image-snapshot-2.9.0.tgz#38d9ac6882c3efeb7125b0cbd58a5cecfb984f77" @@ -16901,6 +16999,20 @@ jest-message-util@^24.8.0: slash "^2.0.0" stack-utils "^1.0.1" +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" + jest-mock@^24.0.0, jest-mock@^24.5.0, jest-mock@^24.8.0: version "24.8.0" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" @@ -16908,6 +17020,13 @@ jest-mock@^24.0.0, jest-mock@^24.5.0, jest-mock@^24.8.0: dependencies: "@jest/types" "^24.8.0" +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== + dependencies: + "@jest/types" "^24.9.0" + jest-pnp-resolver@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" @@ -16941,6 +17060,11 @@ jest-regex-util@^24.3.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== +jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== + jest-resolve-dependencies@^24.8.0: version "24.8.0" resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" @@ -17041,6 +17165,11 @@ jest-serializer@^24.0.0-alpha.6, jest-serializer@^24.4.0: resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== + jest-snapshot@^24.1.0, jest-snapshot@^24.8.0: version "24.8.0" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" @@ -17084,6 +17213,24 @@ jest-util@^24.0.0, jest-util@^24.5.0, jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + jest-validate@^24.8.0: version "24.8.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" @@ -17165,6 +17312,14 @@ jest-worker@^24.0.0-alpha.6, jest-worker@^24.6.0: merge-stream "^1.0.1" supports-color "^6.1.0" +jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + "jest-zone-patch@>=0.0.9 <1.0.0": version "0.0.10" resolved "https://registry.yarnpkg.com/jest-zone-patch/-/jest-zone-patch-0.0.10.tgz#58252f44ab4aad45aaed62a705819577b9709b82" @@ -19621,6 +19776,11 @@ merge-stream@^1.0.1: dependencies: readable-stream "^2.0.1" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + merge-trees@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-trees/-/merge-trees-1.0.1.tgz#ccbe674569787f9def17fd46e6525f5700bbd23e" @@ -29022,6 +29182,11 @@ tryer@^1.0.1: resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== +ts-dedent@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-1.1.0.tgz#67983940793183dc7c7f820acb66ba02cdc33c6e" + integrity sha512-CVCvDwMBWZKjDxpN3mU/Dx1v3k+sJgE8nrhXcC9vRopRfoa7vVzilNvHEAUi5jQnmFHpnxDx5jZdI1TpG8ny2g== + ts-invariant@^0.4.0: version "0.4.4" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86"
+ + Welcome to storybook for Preact + + + + This is a UI component dev environment for your Preact app. + + + We've added some basic stories inside the + + src/stories + + directory. + + A story is a single state of one or more UI components. You can have as many stories as you want. + + (Basically a story is like a visual test case.) + + + See these sample + + stories + + for a component calledย + + Button + + . + + + Just like that, you can add your own components as stories. + + You can also edit those components and see changes right away. + + (Try editing the + + Button + + stories located atย + + src/stories/index.js + + .) + + + Usually we create stories with smaller UI components in the app. + + Have a look at theย + + Writing Stories + + ย section in our documentation. + + + + NOTE: + + + Have a look at the + + .storybook/webpack.config.js + + to add webpack loaders and plugins you are using in this project. + +