Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-6393: Fix data-testId to non hardcoded dynamic values #252

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion react/components/DateField/DateField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const dateTextFieldStyle = {
};

const DateField = ({
id,
id="default_id",
label,
value,
handleDateChange,
Expand Down Expand Up @@ -130,6 +130,10 @@ const DateField = ({
onBlur: rest?.onBlur,
};
},
openPickerButton: {
id: `${id}-open-picker-button`,
dataTestId: `${id}-open-picker-button`
}
}}
slots={{ textField: TextField }}
/>
Expand Down
8 changes: 7 additions & 1 deletion react/components/DateTimeField/DateTimeField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const DateTimeField = ({
dateTimeValue,
handleDateTimeChange,
disabled,
id = "default_dateTime-input",
}) => {
return (
<FormControl>
Expand All @@ -67,9 +68,13 @@ const DateTimeField = ({
disabled={disabled}
slotProps={{
textField: {
id: "dateTime",
id: id, // textfield will delegate an input data-testid based off id
sx: dateTimeTextFieldStyle,
},
openPickerButton: {
id: `${id}-open-picker-button`,
dataTestId: `${id}-open-picker-button`
}
}}
slots={{ textField: TextField }}
/>
Expand All @@ -78,6 +83,7 @@ const DateTimeField = ({
);
};
DateTimeField.propTypes = {
id: PropTypes.string,
dateTimeValue: PropTypes.object,
handleDateTimeChange: PropTypes.func.isRequired,
label: PropTypes.string.isRequired,
Expand Down
1 change: 1 addition & 0 deletions react/components/DateTimeField/DateTimeField.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const TimeDateFieldComponent = (args) => {
<div className="qpp-u-padding--16">
<DateTimeField
// disabled={true}
id="status_date_time"
label="Status Date/Time"
handleDateTimeChange={handleDateTimeChange}
dateTimeValue={value}
Expand Down
Loading