From ec0bff819d443d7ae5917826a36968c991673c2e Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 13 Jul 2020 13:37:59 +1000 Subject: [PATCH] Add a (failing) test case for #11488 --- .../__snapshots__/storyshot.metadata.test.js.snap | 3 +++ .../stories/exported_metadata/Text.stories.js | 5 +++++ .../stories/exported_metadata/main.js | 3 +++ .../stories/exported_metadata/preview.js | 12 ++++++++++++ .../stories/storyshot.metadata.test.js | 9 +++++++++ 5 files changed, 32 insertions(+) create mode 100644 addons/storyshots/storyshots-core/stories/__snapshots__/storyshot.metadata.test.js.snap create mode 100644 addons/storyshots/storyshots-core/stories/exported_metadata/Text.stories.js create mode 100644 addons/storyshots/storyshots-core/stories/exported_metadata/main.js create mode 100644 addons/storyshots/storyshots-core/stories/exported_metadata/preview.js create mode 100644 addons/storyshots/storyshots-core/stories/storyshot.metadata.test.js diff --git a/addons/storyshots/storyshots-core/stories/__snapshots__/storyshot.metadata.test.js.snap b/addons/storyshots/storyshots-core/stories/__snapshots__/storyshot.metadata.test.js.snap new file mode 100644 index 00000000000..90a67c28c8a --- /dev/null +++ b/addons/storyshots/storyshots-core/stories/__snapshots__/storyshot.metadata.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Text Simple 1`] = `"contents"`; diff --git a/addons/storyshots/storyshots-core/stories/exported_metadata/Text.stories.js b/addons/storyshots/storyshots-core/stories/exported_metadata/Text.stories.js new file mode 100644 index 00000000000..e87143f2c78 --- /dev/null +++ b/addons/storyshots/storyshots-core/stories/exported_metadata/Text.stories.js @@ -0,0 +1,5 @@ +export default { + title: 'Text', +}; + +export const Simple = () => 'contents'; diff --git a/addons/storyshots/storyshots-core/stories/exported_metadata/main.js b/addons/storyshots/storyshots-core/stories/exported_metadata/main.js new file mode 100644 index 00000000000..f6e10c62569 --- /dev/null +++ b/addons/storyshots/storyshots-core/stories/exported_metadata/main.js @@ -0,0 +1,3 @@ +module.exports = { + stories: ['./Text.stories.js'], +}; diff --git a/addons/storyshots/storyshots-core/stories/exported_metadata/preview.js b/addons/storyshots/storyshots-core/stories/exported_metadata/preview.js new file mode 100644 index 00000000000..724c84b9a43 --- /dev/null +++ b/addons/storyshots/storyshots-core/stories/exported_metadata/preview.js @@ -0,0 +1,12 @@ +import React from 'react'; + +export const decorators = [ + (StoryFn, { parameters, globals }) => ( +
+ {parameters.prefix} {globals.suffix} +
+ ), +]; + +export const parameters = { prefix: 'prefix' }; +export const globals = { suffix: 'suffix' }; diff --git a/addons/storyshots/storyshots-core/stories/storyshot.metadata.test.js b/addons/storyshots/storyshots-core/stories/storyshot.metadata.test.js new file mode 100644 index 00000000000..38d2d3c1d79 --- /dev/null +++ b/addons/storyshots/storyshots-core/stories/storyshot.metadata.test.js @@ -0,0 +1,9 @@ +import path from 'path'; +import initStoryshots from '../dist'; + +// jest.mock('@storybook/node-logger'); + +initStoryshots({ + framework: 'react', + configPath: path.join(__dirname, 'exported_metadata'), +});