Props: #8428 repro

This commit is contained in:
Michael Shilman 2020-02-15 01:25:36 +08:00
parent dd10817f39
commit 28f7a7ef37
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`react component properties 8428-js-static-prop-types 1`] = `
"function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/require-default-props */
import React from 'react';
import PropTypes from 'prop-types'; // eslint-disable-next-line react/prefer-stateless-function
export default class Test extends React.Component {
render() {
return React.createElement(\\"div\\", null, \\"test\\");
}
}
_defineProperty(Test, \\"propTypes\\", {
/**
* Please work...
* */
test: PropTypes.string
});
export const component = Test;
Test.__docgenInfo = {
\\"description\\": \\"\\",
\\"methods\\": [],
\\"displayName\\": \\"Test\\",
\\"props\\": {
\\"test\\": {
\\"type\\": {
\\"name\\": \\"string\\"
},
\\"required\\": false,
\\"description\\": \\"Please work...\\"
}
}
};"
`;

View File

@ -0,0 +1,20 @@
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/require-default-props */
import React from 'react';
import PropTypes from 'prop-types';
// eslint-disable-next-line react/prefer-stateless-function
export default class Test extends React.Component {
static propTypes = {
/**
* Please work...
*/
test: PropTypes.string,
};
render() {
return <div>test</div>;
}
}
export const component = Test;

View File

@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`react component properties 8428-js-static-prop-types 1`] = `
Object {
"rows": Array [
Object {
"defaultValue": null,
"description": "Please work...",
"name": "test",
"required": false,
"type": Object {
"detail": undefined,
"summary": "string",
},
},
],
}
`;

View File

@ -26,6 +26,7 @@ const fixtures = [
'9493-ts-display-name',
'8894-9511-ts-forward-ref',
'9465-ts-type-props',
'8428-js-static-prop-types',
];
const stories = storiesOf('Properties/React', module);