mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 00:41:54 +08:00
Added more test cases for prop types from an external file
This commit is contained in:
parent
16a51504bc
commit
6fc021be09
@ -0,0 +1,12 @@
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export const PRESET_SHAPE = {
|
||||
text: PropTypes.string.isRequired,
|
||||
startDate: PropTypes.object.isRequired,
|
||||
endDate: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export const SOME_PROP_TYPES = {
|
||||
ext1: PropTypes.string,
|
||||
ext2: PropTypes.number,
|
||||
};
|
@ -1,6 +1,8 @@
|
||||
/* eslint-disable react/require-default-props */
|
||||
/* eslint-disable react/no-unused-prop-types */
|
||||
import React from 'react';
|
||||
import PropTypes, { string, shape } from 'prop-types';
|
||||
import { PRESET_SHAPE, SOME_PROP_TYPES } from './ext';
|
||||
|
||||
const NAMED_OBJECT = {
|
||||
text: PropTypes.string.isRequired,
|
||||
@ -159,6 +161,7 @@ PropTypesProps.propTypes = {
|
||||
),
|
||||
})
|
||||
),
|
||||
arrayExternalShape: PropTypes.arrayOf(PropTypes.shape(PRESET_SHAPE)),
|
||||
/**
|
||||
* A simple `objectOf` propType.
|
||||
*/
|
||||
@ -257,6 +260,7 @@ PropTypesProps.propTypes = {
|
||||
requiredString: PropTypes.string.isRequired,
|
||||
nullDefaultValue: PropTypes.string,
|
||||
undefinedDefaultValue: PropTypes.string,
|
||||
...SOME_PROP_TYPES,
|
||||
};
|
||||
|
||||
PropTypesProps.defaultProps = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user