Skip to content

Commit

Permalink
Updated to check for 'storybook' when determining whether to run stor…
Browse files Browse the repository at this point in the history
…yshots
  • Loading branch information
John Rodriguez authored and John Rodriguez committed Apr 28, 2017
1 parent a63119b commit 3d8d6ea
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
7 changes: 5 additions & 2 deletions packages/storyshots/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ const babel = require('babel-core');
const pkg = readPkgUp.sync().pkg;
const isStorybook =
(pkg.devDependencies && pkg.devDependencies['@kadira/storybook']) ||
(pkg.dependencies && pkg.dependencies['@kadira/storybook']);
(pkg.dependencies && pkg.dependencies['@kadira/storybook']) ||
(pkg.name === 'storybook');
const isRNStorybook =
(pkg.devDependencies && pkg.devDependencies['@kadira/react-native-storybook']) ||
(pkg.dependencies && pkg.dependencies['@kadira/react-native-storybook']);
(pkg.dependencies && pkg.dependencies['@kadira/react-native-storybook']) ||
(pkg.name === '@kadira/react-native-storybook');


export default function testStorySnapshots(options = {}) {
addons.setChannel(createChannel());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Another Button with some emoji 1`] = `
<button
onClick={[Function]}
Expand All @@ -11,7 +13,8 @@ exports[`Storyshots Another Button with some emoji 1`] = `
"margin": 10,
"padding": "3px 10px",
}
}>
}
>
😀 😎 👍 💯
</button>
`;
Expand All @@ -29,7 +32,8 @@ exports[`Storyshots Another Button with text 1`] = `
"margin": 10,
"padding": "3px 10px",
}
}>
}
>
Hello Button
</button>
`;
Expand All @@ -47,7 +51,8 @@ exports[`Storyshots Button with some emoji 1`] = `
"margin": 10,
"padding": "3px 10px",
}
}>
}
>
😀 😎 👍 💯
</button>
`;
Expand All @@ -65,7 +70,8 @@ exports[`Storyshots Button with text 1`] = `
"margin": 10,
"padding": "3px 10px",
}
}>
}
>
Hello Button
</button>
`;
Expand All @@ -84,28 +90,30 @@ exports[`Storyshots Component with ref on mount 1`] = `
}
}
type="text"
value="This component reads its scrollWidth on load." />
value="This component reads its scrollWidth on load."
/>
`;

exports[`Storyshots Welcome to Storybook 1`] = `
<div
style={
Object {
"fontFamily": "\"Helvetica Neue\", Helvetica, \"Segoe UI\", Arial, freesans, sans-serif",
"fontFamily": "\\"Helvetica Neue\\", Helvetica, \\"Segoe UI\\", Arial, freesans, sans-serif",
"lineHeight": 1.4,
"margin": 15,
"maxWidth": 600,
}
}>
}
>
<h1>
Welcome to STORYBOOK
</h1>
<p>
This is a UI component dev environment for your app.
</p>
<p>
We\'ve added some basic stories inside the
We've added some basic stories inside the
<code
style={
Object {
Expand All @@ -117,10 +125,11 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"fontWeight": 600,
"padding": "2px 5px",
}
}>
}
>
src/stories
</code>
directory.
<br />
A story is a single state of one or more UI components. You can have as many stories as you want.
Expand All @@ -129,7 +138,7 @@ exports[`Storyshots Welcome to Storybook 1`] = `
</p>
<p>
See these sample
<a
href="#"
onClick={[Function]}
Expand All @@ -140,12 +149,13 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"paddingBottom": 2,
"textDecoration": "none",
}
}>
}
>
stories
</a>
for a component called
<code
style={
Object {
Expand All @@ -157,7 +167,8 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"fontWeight": 600,
"padding": "2px 5px",
}
}>
}
>
Button
</code>
.
Expand All @@ -167,7 +178,7 @@ exports[`Storyshots Welcome to Storybook 1`] = `
<br />
You can also edit those components and see changes right away.
<br />
(Try editing the
(Try editing the
<code
style={
Object {
Expand All @@ -179,10 +190,11 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"fontWeight": 600,
"padding": "2px 5px",
}
}>
}
>
Button
</code>
component located at
component located at
<code
style={
Object {
Expand All @@ -194,7 +206,8 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"fontWeight": 600,
"padding": "2px 5px",
}
}>
}
>
stories/Button.js
</code>
.)
Expand All @@ -203,7 +216,7 @@ exports[`Storyshots Welcome to Storybook 1`] = `
This is just one thing you can do with Storybook.
<br />
Have a look at the
<a
href="https://github.com/kadirahq/react-storybook"
style={
Expand All @@ -214,10 +227,11 @@ exports[`Storyshots Welcome to Storybook 1`] = `
"textDecoration": "none",
}
}
target="_blank">
target="_blank"
>
React Storybook
</a>
repo for more information.
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/storyshots/stories/__test__/storyshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function createNodeMock (element) {
return null;
}

initStoryshots({ rendererOptions: { createNodeMock } });
initStoryshots({ rendererOptions: { createNodeMock }, configPath: './packages/storyshots/.storybook' });

0 comments on commit 3d8d6ea

Please sign in to comment.