diff --git a/addons/info/src/components/PropTable.js b/addons/info/src/components/PropTable.js index 222666041a57..c2e9ef81c313 100644 --- a/addons/info/src/components/PropTable.js +++ b/addons/info/src/components/PropTable.js @@ -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, }) diff --git a/addons/storyshots/src/test-bodies.js b/addons/storyshots/src/test-bodies.js index ca83521be6ef..7380e72ac0dc 100644 --- a/addons/storyshots/src/test-bodies.js +++ b/addons/storyshots/src/test-bodies.js @@ -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({}); diff --git a/examples/cra-kitchen-sink/src/components/TableComponent.js b/examples/cra-kitchen-sink/src/components/TableComponent.js index 1d66f0a2a95b..d963e0a1f517 100644 --- a/examples/cra-kitchen-sink/src/components/TableComponent.js +++ b/examples/cra-kitchen-sink/src/components/TableComponent.js @@ -11,7 +11,7 @@ const TableComponent = ({ propDefinitions }) => { {required ? * : null} {propType.name} - {defaultValue} + {JSON.stringify(defaultValue)} {description} ) diff --git a/examples/cra-kitchen-sink/src/stories/__snapshots__/addon-info.stories.storyshot b/examples/cra-kitchen-sink/src/stories/__snapshots__/addon-info.stories.storyshot index 297d8f712cbc..c161f17376d2 100644 --- a/examples/cra-kitchen-sink/src/stories/__snapshots__/addon-info.stories.storyshot +++ b/examples/cra-kitchen-sink/src/stories/__snapshots__/addon-info.stories.storyshot @@ -791,6 +791,193 @@ exports[`Storyshots Addon Info.Markdown Displays Markdown in description 1`] = ` `; +exports[`Storyshots Addon Info.Options.TableComponent Use a custom component for the table 1`] = ` +
+
+ +
+ +
+ +
+
+
+

+ Addon Info.Options.TableComponent +

+

+ Use a custom component for the table +

+
+
+

+ Story Source +

+
+            
+ + <BaseButton + + + + + + label + + + = + + + "Button" + + + + + + + + /> + +
+
+
+
+

+ Prop Types +

+
+

+ "BaseButton" Component +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ name + + type + + default + + description +
+ disabled + + + + false + + +
+ label + + * + + + + + + + +
+ onClick + + + + + + +
+ style + + + + {} + + +
+
+
+
+
+
+
+`; + exports[`Storyshots Addon Info.Options.header Shows or hides Info Addon header 1`] = `
My birthday is: January 20, 2017

+

+ I live in NY for 9 years. +

My wallet contains: $12.50