From b74226ef4fd3dde7972ce192ceb0488f0ed5f9d0 Mon Sep 17 00:00:00 2001 From: Shamayl Naaz Date: Tue, 24 Sep 2024 10:16:06 +0000 Subject: [PATCH] fix(menutrigger): role to be generic --- src/components/MenuTrigger/MenuTrigger.tsx | 1 + .../MenuTrigger/MenuTrigger.unit.test.tsx | 8 +-- .../MenuTrigger.unit.test.tsx.snap | 63 +++++++++++-------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/components/MenuTrigger/MenuTrigger.tsx b/src/components/MenuTrigger/MenuTrigger.tsx index 8247c393f9..cfc25a40b1 100644 --- a/src/components/MenuTrigger/MenuTrigger.tsx +++ b/src/components/MenuTrigger/MenuTrigger.tsx @@ -122,6 +122,7 @@ const MenuTrigger = forwardRef( className={classnames(className, STYLE.wrapper)} trigger="click" id={id} + role="generic" style={style} placement={placement as PlacementType} interactive={true} diff --git a/src/components/MenuTrigger/MenuTrigger.unit.test.tsx b/src/components/MenuTrigger/MenuTrigger.unit.test.tsx index f6804d9551..9b102294ee 100644 --- a/src/components/MenuTrigger/MenuTrigger.unit.test.tsx +++ b/src/components/MenuTrigger/MenuTrigger.unit.test.tsx @@ -132,7 +132,7 @@ describe(' - Enzyme', () => { .find(MenuTrigger) .find(ModalContainer) .children() - .find('[role="dialog"]') + .find('[role="generic"]') .getDOMNode(); expect(element.classList.contains(CONSTANTS.STYLE.wrapper)).toBe(true); @@ -147,7 +147,7 @@ describe(' - Enzyme', () => { .find(MenuTrigger) .find(ModalContainer) .children() - .find('[role="dialog"]') + .find('[role="generic"]') .getDOMNode(); expect(element.classList.contains(className)).toBe(true); @@ -162,7 +162,7 @@ describe(' - Enzyme', () => { .find(MenuTrigger) .find(ModalContainer) .children() - .find('[role="dialog"]') + .find('[role="generic"]') .getDOMNode(); expect(element.id).toBe(id); @@ -178,7 +178,7 @@ describe(' - Enzyme', () => { .find(MenuTrigger) .find(ModalContainer) .children() - .find('[role="dialog"]') + .find('[role="generic"]') .getDOMNode(); expect(element.getAttribute('style')).toBe(styleString); diff --git a/src/components/MenuTrigger/MenuTrigger.unit.test.tsx.snap b/src/components/MenuTrigger/MenuTrigger.unit.test.tsx.snap index 32c9364970..f7a26cc88a 100644 --- a/src/components/MenuTrigger/MenuTrigger.unit.test.tsx.snap +++ b/src/components/MenuTrigger/MenuTrigger.unit.test.tsx.snap @@ -19,6 +19,7 @@ exports[` - Enzyme snapshot should match snapshot 1`] = ` onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -290,7 +291,7 @@ exports[` - Enzyme snapshot should match snapshot 1`] = ` data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot 1`] = ` isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -484,7 +485,7 @@ exports[` - Enzyme snapshot should match snapshot 1`] = ` data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -2219,6 +2220,7 @@ exports[` - Enzyme snapshot should match snapshot with className onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -2490,7 +2492,7 @@ exports[` - Enzyme snapshot should match snapshot with className data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with className isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -2684,7 +2686,7 @@ exports[` - Enzyme snapshot should match snapshot with className data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -4419,6 +4421,7 @@ exports[` - Enzyme snapshot should match snapshot with color 1`] onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -4690,7 +4693,7 @@ exports[` - Enzyme snapshot should match snapshot with color 1`] data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with color 1`] isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -4884,7 +4887,7 @@ exports[` - Enzyme snapshot should match snapshot with color 1`] data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -6620,6 +6623,7 @@ exports[` - Enzyme snapshot should match snapshot with id 1`] = ` onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -6892,7 +6896,7 @@ exports[` - Enzyme snapshot should match snapshot with id 1`] = ` data-placement="bottom-start" data-round="75" id="example-id" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with id 1`] = ` isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -7088,7 +7092,7 @@ exports[` - Enzyme snapshot should match snapshot with id 1`] = ` data-round={75} id="example-id" onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -8823,6 +8827,7 @@ exports[` - Enzyme snapshot should match snapshot with placement onClickOutside={[Function]} onKeyDown={[Function]} placement="top" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -9094,7 +9099,7 @@ exports[` - Enzyme snapshot should match snapshot with placement data-padded="true" data-placement="top" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with placement isPadded={true} onKeyDown={[Function]} placement="top" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -9288,7 +9293,7 @@ exports[` - Enzyme snapshot should match snapshot with placement data-placement="top" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -11023,6 +11028,7 @@ exports[` - Enzyme snapshot should match snapshot with showArrow onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={true} trigger="click" @@ -11294,7 +11300,7 @@ exports[` - Enzyme snapshot should match snapshot with showArrow data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with showArrow isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={true} > @@ -11519,7 +11525,7 @@ exports[` - Enzyme snapshot should match snapshot with showArrow data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -13293,6 +13299,7 @@ exports[` - Enzyme snapshot should match snapshot with style 1`] onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} style={ @@ -13569,7 +13576,7 @@ exports[` - Enzyme snapshot should match snapshot with style 1`] data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" style="color: pink;" >
- Enzyme snapshot should match snapshot with style 1`] isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} style={ @@ -13769,7 +13776,7 @@ exports[` - Enzyme snapshot should match snapshot with style 1`] data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" style={ Object { "color": "pink", @@ -15509,6 +15516,7 @@ exports[` - Enzyme snapshot should match snapshot with variant 1` onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -15780,7 +15788,7 @@ exports[` - Enzyme snapshot should match snapshot with variant 1` data-padded="true" data-placement="bottom-start" data-round="50" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with variant 1` isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={50} showArrow={false} > @@ -15974,7 +15982,7 @@ exports[` - Enzyme snapshot should match snapshot with variant 1` data-placement="bottom-start" data-round={50} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2" @@ -17709,6 +17717,7 @@ exports[` - Enzyme snapshot should match snapshot with zIndex 1`] onClickOutside={[Function]} onKeyDown={[Function]} placement="bottom-start" + role="generic" setInstance={[Function]} showArrow={false} trigger="click" @@ -17984,7 +17993,7 @@ exports[` - Enzyme snapshot should match snapshot with zIndex 1`] data-padded="true" data-placement="bottom-start" data-round="75" - role="dialog" + role="generic" >
- Enzyme snapshot should match snapshot with zIndex 1`] isPadded={true} onKeyDown={[Function]} placement="bottom-start" - role="dialog" + role="generic" round={75} showArrow={false} > @@ -18178,7 +18187,7 @@ exports[` - Enzyme snapshot should match snapshot with zIndex 1`] data-placement="bottom-start" data-round={75} onKeyDown={[Function]} - role="dialog" + role="generic" > <_Menu key=".$2"