i have created a custom checkbox wrapper and want to check that that the inner checkbox is selected and that the other checkboxes are disabled
I couldnt find the answer on here so I found one myself and here is how I did it...
ANSWER
const checkbox = await within(
await screen.findByTestId('test-id-item-123'),
).findByTestId('inner-checkbox-id');
expect(checkbox).not.toBeChecked();
expect(checkbox).not.toBeDisabled();
fireEvent.click(checkbox);
expect(checkbox).toBeChecked();
expect(checkbox).not.toBeDisabled();
const disabled_checkbox = await within(
await screen.findByTestId('test-id-item-123456'),
).findByTestId('inner-checkbox-id');
expect(disabled_checkbox).not.toBeChecked();
expect(disabled_checkbox).toBeDisabled();
Aucun commentaire:
Enregistrer un commentaire