fix RelationInput proptypes issues

This commit is contained in:
Julie Plantey 2022-09-13 12:25:50 +02:00
parent 2766b93940
commit f7b51cd2f2
5 changed files with 6 additions and 5 deletions

View File

@ -156,7 +156,7 @@ const RelationInput = ({
inputId={id} inputId={id}
isSearchable isSearchable
isClear isClear
loadingMessage={() => loadingMessage} loadingMessage={loadingMessage}
onChange={(relation) => { onChange={(relation) => {
setValue(null); setValue(null);
onRelationAdd(relation); onRelationAdd(relation);

View File

@ -50,5 +50,5 @@ Relation.propTypes = {
search: PropTypes.node, search: PropTypes.node,
loadMore: PropTypes.node, loadMore: PropTypes.node,
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
totalNumberOfRelations: PropTypes.string, totalNumberOfRelations: PropTypes.number,
}; };

View File

@ -43,10 +43,10 @@ export const RelationList = ({ children, ...props }) => {
}; };
RelationList.defaultProps = { RelationList.defaultProps = {
overflow: undefined, overflow: '',
}; };
RelationList.propTypes = { RelationList.propTypes = {
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
overflow: PropTypes.oneOf(['top-bottom', 'bottom', 'top']), overflow: PropTypes.oneOf(['top-bottom', 'bottom', 'top', '']),
}; };

View File

@ -97,6 +97,7 @@ exports[`Content-Manager || RelationInput || RelationList should render and matc
<div> <div>
<div <div
class="c0" class="c0"
overflow=""
> >
<div <div
class="c1 c2" class="c1 c2"

View File

@ -63,7 +63,7 @@ const setup = (props) =>
name="some-relation-1" name="some-relation-1"
label="Some Relation" label="Some Relation"
labelLoadMore="Load more" labelLoadMore="Load more"
loadingMessage="Relations are loading" loadingMessage={() => 'Relations are loading'}
numberOfRelationsToDisplay={5} numberOfRelationsToDisplay={5}
onRelationAdd={() => jest.fn()} onRelationAdd={() => jest.fn()}
onSearchOpen={() => jest.fn()} onSearchOpen={() => jest.fn()}