forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request storybookjs#3747 from storybooks/storyshots-advanc…
…ed-config Storyshots advanced config options
- Loading branch information
Showing
21 changed files
with
358 additions
and
59 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
addons/storyshots/storyshots-core/.storybook/configTest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
const req = require.context('../stories/required_with_context', true, /.stories.js$/); | ||
|
||
function loadStories() { | ||
req.keys().forEach(filename => req(filename)); | ||
// eslint-disable-next-line global-require | ||
require('../stories/directly_required'); | ||
} | ||
|
||
configure(loadStories, module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 23 additions & 7 deletions
30
addons/storyshots/storyshots-core/src/frameworks/config-loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
addons/storyshots/storyshots-core/src/frameworks/configure.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import loadConfig from './config-loader'; | ||
import runWithRequireContext from './require_context'; | ||
|
||
function configure(options) { | ||
const { configPath = '.storybook', config, frameworkOptions, storybook } = options; | ||
|
||
if (config && typeof config === 'function') { | ||
config(storybook); | ||
return; | ||
} | ||
|
||
const appOptions = require.requireActual(frameworkOptions).default; | ||
|
||
const { content, contextOpts } = loadConfig({ | ||
configPath, | ||
appOptions, | ||
}); | ||
|
||
runWithRequireContext(content, contextOpts); | ||
} | ||
|
||
export default configure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
addons/storyshots/storyshots-core/src/frameworks/react/loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
addons/storyshots/storyshots-core/stories/directly_required/__snapshots__/index.foo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Another Button with some emoji 1`] = ` | ||
<button | ||
className="css-1qwzad5" | ||
onClick={[Function]} | ||
> | ||
<span | ||
aria-label="so cool" | ||
role="img" | ||
> | ||
😀 😎 👍 💯 | ||
</span> | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Another Button with text 1`] = ` | ||
<button | ||
className="css-1qwzad5" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; |
15 changes: 15 additions & 0 deletions
15
...re/stories/directly_required/__snapshots__/index@Another-_-Button@with-_-some-_-emoji.boo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Another Button with some emoji 1`] = ` | ||
<button | ||
className="css-1qwzad5" | ||
onClick={[Function]} | ||
> | ||
<span | ||
aria-label="so cool" | ||
role="img" | ||
> | ||
😀 😎 👍 💯 | ||
</span> | ||
</button> | ||
`; |
10 changes: 10 additions & 0 deletions
10
...shots-core/stories/directly_required/__snapshots__/index@Another-_-Button@with-_-text.boo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Another Button with text 1`] = ` | ||
<button | ||
className="css-1qwzad5" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; |
Oops, something went wrong.