Skip to content

Commit

Permalink
fix: harmonize support for additional props in all basic input compon…
Browse files Browse the repository at this point in the history
…ents

Lack of additional props prevent integrators from adding custom data-cy properties
for Cypress selectors.
  • Loading branch information
csm-thu committed Oct 29, 2021
1 parent 269c6a8 commit 3019202
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/inputs/BasicInputs/BasicDateInput/BasicDateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import DateFnsUtils from '@date-io/date-fns';
import { MuiPickersUtilsProvider, KeyboardDatePicker } from '@material-ui/pickers';

export const BasicDateInput = (props) => {
const { id, label, format, value, dateProps, changeSelectedDate } = props;
const { id, label, format, value, dateProps, changeSelectedDate, ...otherProps } = props;

return (
<MuiPickersUtilsProvider utils={DateFnsUtils}>
Expand All @@ -19,13 +19,13 @@ export const BasicDateInput = (props) => {
format={format}
label={label}
id={id}
data-cy={id + '-date-input'}
onChange={changeSelectedDate}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
value={value}
{...dateProps}
{...otherProps}
/>
</MuiPickersUtilsProvider>
);
Expand Down
7 changes: 4 additions & 3 deletions src/inputs/BasicInputs/BasicEnumInput/BasicEnumInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ const useStyles = makeStyles((theme) => ({

export const BasicEnumInput = (props) => {
const classes = useStyles();
const { label, value, textFieldProps, enumValues, changeEnumField } = props;
const { containerProps, labelProps } = props;
const { label, value, textFieldProps, enumValues, changeEnumField, containerProps, labelProps, ...otherProps } =
props;

return (
<Grid container className={classes.root} {...containerProps}>
<Grid container className={classes.root} {...containerProps} {...otherProps}>
<Grid item>
<Typography {...labelProps}>{label}</Typography>
</Grid>
<Grid item>
<TextField
data-cy="text_field"
select
value={value}
{...textFieldProps}
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/BasicInputs/BasicTextInput/BasicTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const useStyles = makeStyles((theme) => ({

export const BasicTextInput = (props) => {
const classes = useStyles();
const { label, value, textFieldProps, changeTextField, containerProps, labelProps } = props;
const { label, value, textFieldProps, changeTextField, containerProps, labelProps, ...otherProps } = props;

return (
<Grid container className={classes.root} {...containerProps}>
<Grid container className={classes.root} {...containerProps} {...otherProps}>
<Grid item>
<Typography {...labelProps}>{label}</Typography>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/BasicInputs/BasicToggleInput/BasicToggleInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const useStyles = makeStyles((theme) => ({

export const BasicToggleInput = (props) => {
const classes = useStyles();
const { label, value, switchProps, changeSwitchType, containerProps, labelProps } = props;
const { label, value, switchProps, changeSwitchType, containerProps, labelProps, ...otherProps } = props;

return (
<Grid container className={classes.root} {...containerProps}>
<Grid container className={classes.root} {...containerProps} {...otherProps}>
<Grid item>
<Typography {...labelProps}>{label}</Typography>
</Grid>
Expand Down

0 comments on commit 3019202

Please sign in to comment.