Skip to content

Commit

Permalink
reverted to having testId on <Checkbox> as type error when passing it…
Browse files Browse the repository at this point in the history
… down to input
  • Loading branch information
dr-bizz committed Nov 15, 2023
1 parent df7262e commit 1266a87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ describe('NotificationsTable', () => {
expect(queryByTestId('skeleton-notifications')).not.toBeInTheDocument(),
);

const appCheckbox = getByTestId('CALL_PARTNER_ONCE_PER_YEAR-app-checkbox');
const appCheckbox = getByTestId(
'CALL_PARTNER_ONCE_PER_YEAR-app-checkbox',
).querySelectorAll("input[type='checkbox']")[0] as HTMLInputElement;
const emailCheckbox = getByTestId(
'CALL_PARTNER_ONCE_PER_YEAR-email-checkbox',
);
).querySelectorAll("input[type='checkbox']")[0] as HTMLInputElement;
const taskCheckbox = getByTestId(
'CALL_PARTNER_ONCE_PER_YEAR-task-checkbox',
);
).querySelectorAll("input[type='checkbox']")[0] as HTMLInputElement;

expect(appCheckbox).not.toBeChecked();
expect(emailCheckbox).not.toBeChecked();
Expand Down
12 changes: 3 additions & 9 deletions src/components/Settings/notifications/NotificationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ export const NotificationsTable: React.FC = () => {
</StyledTableCell>
<StyledTableCell align="right">
<Checkbox
data-testid={`${type}-app-checkbox`}
checked={notification.app}
disabled={isSubmitting}
onChange={(_, value) => {
Expand All @@ -340,13 +341,11 @@ export const NotificationsTable: React.FC = () => {
value,
);
}}
inputProps={{
'data-testid': `${type}-app-checkbox`,
}}
/>
</StyledTableCell>
<StyledTableCell align="right">
<Checkbox
data-testid={`${type}-email-checkbox`}
checked={notification.email}
disabled={isSubmitting}
onChange={(_, value) => {
Expand All @@ -355,13 +354,11 @@ export const NotificationsTable: React.FC = () => {
value,
);
}}
inputProps={{
'data-testid': `${type}-email-checkbox`,
}}
/>
</StyledTableCell>
<StyledTableCell align="right">
<Checkbox
data-testid={`${type}-task-checkbox`}
checked={notification.task}
disabled={isSubmitting}
onChange={(_, value) => {
Expand All @@ -370,9 +367,6 @@ export const NotificationsTable: React.FC = () => {
value,
);
}}
inputProps={{
'data-testid': `${type}-task-checkbox`,
}}
/>
</StyledTableCell>
</StyledTableRow>
Expand Down

0 comments on commit 1266a87

Please sign in to comment.