Skip to content

Commit 7d953db

Browse files
committed
fix: use userEvent.pointer for checkbox toggling
1 parent ba4af7f commit 7d953db

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/interviewer/Interfaces/FamilyPedigree/FamilyPedigree.stories.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,22 +1001,18 @@ export const SingleParentTwoDonors: ScenarioStory = {
10011001
// SiblingsDetailStep: ego's parents + 1 sibling
10021002

10031003
// Uncheck Donor 2 from ego's parents
1004-
// Find the checkbox and click its parent label to toggle
10051004
const egoParentsContainer = await screen.findByTestId(
10061005
'ego-parents-checkboxes',
10071006
{},
10081007
STEP_TIMEOUT,
10091008
);
10101009
const egoScope = within(egoParentsContainer);
1011-
const donor2InEgo = await egoScope.findByRole(
1010+
const donor2Checkbox = await egoScope.findByRole(
10121011
'checkbox',
10131012
{ name: 'Donor 2' },
10141013
STEP_TIMEOUT,
10151014
);
1016-
const donor2Label = donor2InEgo.closest('label');
1017-
if (donor2Label) {
1018-
await userEvent.click(donor2Label);
1019-
}
1015+
await userEvent.pointer({ keys: '[MouseLeft]', target: donor2Checkbox });
10201016
await waitForStepTransition();
10211017

10221018
// Fill sibling details
@@ -1034,11 +1030,10 @@ export const SingleParentTwoDonors: ScenarioStory = {
10341030
{ name: 'Donor 1' },
10351031
STEP_TIMEOUT,
10361032
);
1037-
// The sibling's "Donor 1" is the second one (index 1)
1038-
const donor1Label = donor1Checkboxes[1]?.closest('label');
1039-
if (donor1Label) {
1040-
await userEvent.click(donor1Label);
1041-
}
1033+
await userEvent.pointer({
1034+
keys: '[MouseLeft]',
1035+
target: donor1Checkboxes[1]!,
1036+
});
10421037
await waitForStepTransition();
10431038
await clickContinue();
10441039
await waitForStepTransition();

0 commit comments

Comments
 (0)