Make the test more realistic

This commit is contained in:
Tanguy Krotoff 2019-02-19 00:57:38 +01:00
parent 72a3259557
commit a258dc9251

View File

@ -31,18 +31,30 @@ class Test extends React.Component {
return (
<form onSubmit={this.handleFormSubmit}>
<PlacesAutocomplete value={this.state.address} onChange={this.onChange} googleCallbackName="google_callback_name">
{({getInputProps, getSuggestionItemProps, suggestions}) => (
<>
<input {...getInputProps()} />
<div>
{suggestions.map(suggestion => (
<div {...getSuggestionItemProps(suggestion)} >
{suggestion.description}
</div>
))}
</div>
</>
)}
{({getInputProps, suggestions, getSuggestionItemProps, loading}) => {
const inputProps = getInputProps({
required: true,
className: loading ? 'is-pending' : ''
});
return (
<>
<input {...inputProps} />
<div>
{suggestions.map(suggestion => {
const divProps = getSuggestionItemProps(suggestion, {
className: suggestion.active ? 'active' : ''
});
return (
<div {...divProps}>
{suggestion.description}
</div>
);
})}
</div>
</>
);
}
}
</PlacesAutocomplete>
</form>
);