Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests not actually running #2450

Merged
merged 3 commits into from
Dec 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/info/src/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ PropTable.propTypes = {
propDefinitions: PropTypes.arrayOf(
PropTypes.shape({
property: PropTypes.string.isRequired,
propType: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,
required: PropTypes.bool.isRequired,
propType: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
required: PropTypes.bool,
description: PropTypes.string,
defaultValue: PropTypes.any,
})
Expand Down
8 changes: 5 additions & 3 deletions addons/storyshots/src/test-bodies.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export const snapshotWithOptions = options => ({ story, context, snapshotFileNam
expect(tree).toMatchSnapshot();
}

tree.unmount();
if (typeof tree.unmount === 'function') {
tree.unmount();
}
};

export const multiSnapshotWithOptions = options => ({ context }) => {
snapshotWithOptions({ ...options, snapshotFileName: getSnapshotFileName(context) });
export const multiSnapshotWithOptions = options => ({ story, context }) => {
snapshotWithOptions(options)({ story, context, snapshotFileName: getSnapshotFileName(context) });
};

export const snapshot = snapshotWithOptions({});
Expand Down
2 changes: 1 addition & 1 deletion examples/cra-kitchen-sink/src/components/TableComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TableComponent = ({ propDefinitions }) => {
{required ? <Red>*</Red> : null}
</td>
<td>{propType.name}</td>
<td>{defaultValue}</td>
<td>{JSON.stringify(defaultValue)}</td>
<td>{description}</td>
</tr>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,193 @@ exports[`Storyshots Addon Info.Markdown Displays Markdown in description 1`] = `
</div>
`;

exports[`Storyshots Addon Info.Options.TableComponent Use a custom component for the table 1`] = `
<div>
<div
style="position:relative;z-index:0"
>
<button>
Button
</button>
</div>
<button
style="font-family:sans-serif;font-size:12px;display:block;position:fixed;border:none;background:#28c;color:#fff;padding:5px 15px;cursor:pointer;top:0;right:0;border-radius:0 0 0 5px"
type="button"
>
Show Info
</button>
<div
style="position:fixed;background:white;top:0;bottom:0;left:0;right:0;padding:0 40px;overflow:auto;z-index:99999;display:none"
>
<button
style="font-family:sans-serif;font-size:12px;display:block;position:fixed;border:none;background:#28c;color:#fff;padding:5px 15px;cursor:pointer;top:0;right:0;border-radius:0 0 0 5px"
type="button"
>
×
</button>
<div>
<div
style="font-family:-apple-system, \\".SFNSText-Regular\\", \\"San Francisco\\", BlinkMacSystemFont, \\"Segoe UI\\", \\"Roboto\\", \\"Oxygen\\", \\"Ubuntu\\", \\"Cantarell\\", \\"Fira Sans\\", \\"Droid Sans\\", \\"Helvetica Neue\\", \\"Lucida Grande\\", \\"Arial\\", sans-serif;color:#444;-webkit-font-smoothing:antialiased;font-weight:300;line-height:1.45;font-size:15px;border:1px solid #eee;padding:20px 40px 40px;border-radius:2px;box-shadow:0px 2px 3px rgba(0, 0, 0, 0.05);background-color:#fff;margin-top:50px"
>
<div
style="border-bottom:1px solid #eee;padding-top:10px;margin-bottom:10px"
>
<h1
style="margin:0;padding:0;font-size:35px"
>
Addon Info.Options.TableComponent
</h1>
<h2
style="margin:0 0 10px 0;padding:0;font-weight:400;font-size:22px"
>
Use a custom component for the table
</h2>
</div>
<div>
<h1
style="margin:20px 0 0 0;padding:0 0 5px 0;font-size:25px;border-bottom:1px solid #EEE"
>
Story Source
</h1>
<pre
style="font-size:.88em;font-family:Menlo, Monaco, \\"Courier New\\", monospace;background-color:#fafafa;padding:.5rem;line-height:1.5;overflow-x:scroll"
>
<div
style="padding-left:18px;padding-right:3px"
>
<span
style="color:#777"
>
&lt;BaseButton
</span>
<span>
<span>

<span>
label
</span>
<span>
=
<span>
<span
style="color:#22a;word-break:break-word"
>
"Button"
</span>
</span>
</span>

</span>
</span>
<span
style="color:#777"
>
/&gt;
</span>
</div>
</pre>
</div>
<div>
<h1
style="margin:20px 0 0 0;padding:0 0 5px 0;font-size:25px;border-bottom:1px solid #EEE"
>
Prop Types
</h1>
<div>
<h2
style="margin:20px 0 0 0"
>
"BaseButton" Component
</h2>
<table>
<thead>
<tr>
<th>
name
</th>
<th>
type
</th>
<th>
default
</th>
<th>
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
disabled
</td>
<td>

</td>
<td>
false
</td>
<td>

</td>
</tr>
<tr>
<td>
label
<span
style="color:red"
>
*
</span>
</td>
<td>

</td>
<td>

</td>
<td>

</td>
</tr>
<tr>
<td>
onClick
</td>
<td>

</td>
<td>

</td>
<td>

</td>
</tr>
<tr>
<td>
style
</td>
<td>

</td>
<td>
{}
</td>
<td>

</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
`;

exports[`Storyshots Addon Info.Options.header Shows or hides Info Addon header 1`] = `
<div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ exports[`Storyshots Addon Knobs.withKnobs tweaks static values 1`] = `
<p>
My birthday is: January 20, 2017
</p>
<p>
I live in NY for 9 years.
</p>
<p>
My wallet contains: $12.50
</p>
Expand Down