Skip to content

Commit

Permalink
fix(menutrigger): role to be generic
Browse files Browse the repository at this point in the history
  • Loading branch information
shnaaz committed Sep 24, 2024
1 parent fbd00ef commit bd0d5db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/components/MenuTrigger/MenuTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 4 additions & 4 deletions src/components/MenuTrigger/MenuTrigger.unit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('<MenuTrigger /> - Enzyme', () => {
.find(MenuTrigger)
.find(ModalContainer)
.children()
.find('[role="dialog"]')
.find('[role="generic"]')
.getDOMNode();

expect(element.classList.contains(CONSTANTS.STYLE.wrapper)).toBe(true);
Expand All @@ -147,7 +147,7 @@ describe('<MenuTrigger /> - Enzyme', () => {
.find(MenuTrigger)
.find(ModalContainer)
.children()
.find('[role="dialog"]')
.find('[role="generic"]')
.getDOMNode();

expect(element.classList.contains(className)).toBe(true);
Expand All @@ -162,7 +162,7 @@ describe('<MenuTrigger /> - Enzyme', () => {
.find(MenuTrigger)
.find(ModalContainer)
.children()
.find('[role="dialog"]')
.find('[role="generic"]')
.getDOMNode();

expect(element.id).toBe(id);
Expand All @@ -178,7 +178,7 @@ describe('<MenuTrigger /> - Enzyme', () => {
.find(MenuTrigger)
.find(ModalContainer)
.children()
.find('[role="dialog"]')
.find('[role="generic"]')
.getDOMNode();

expect(element.getAttribute('style')).toBe(styleString);
Expand Down
63 changes: 36 additions & 27 deletions src/components/MenuTrigger/MenuTrigger.unit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot 1`] = `
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -290,7 +291,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot 1`] = `
data-padded="true"
data-placement="bottom-start"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -460,7 +461,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot 1`] = `
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -484,7 +485,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot 1`] = `
data-placement="bottom-start"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -2219,6 +2220,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with className
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -2490,7 +2492,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with className
data-padded="true"
data-placement="bottom-start"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -2660,7 +2662,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with className
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -2684,7 +2686,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with className
data-placement="bottom-start"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -4419,6 +4421,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with color 1`]
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -4690,7 +4693,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with color 1`]
data-padded="true"
data-placement="bottom-start"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -4860,7 +4863,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with color 1`]
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -4884,7 +4887,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with color 1`]
data-placement="bottom-start"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -6620,6 +6623,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with id 1`] = `
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -6892,7 +6896,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with id 1`] = `
data-placement="bottom-start"
data-round="75"
id="example-id"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -7063,7 +7067,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with id 1`] = `
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -7088,7 +7092,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with id 1`] = `
data-round={75}
id="example-id"
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -8823,6 +8827,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with placement
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="top"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -9094,7 +9099,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with placement
data-padded="true"
data-placement="top"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -9264,7 +9269,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with placement
isPadded={true}
onKeyDown={[Function]}
placement="top"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -9288,7 +9293,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with placement
data-placement="top"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -11023,6 +11028,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with showArrow
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={true}
trigger="click"
Expand Down Expand Up @@ -11294,7 +11300,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with showArrow
data-padded="true"
data-placement="bottom-start"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -11495,7 +11501,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with showArrow
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={true}
>
Expand All @@ -11519,7 +11525,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with showArrow
data-placement="bottom-start"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -13293,6 +13299,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with style 1`]
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
style={
Expand Down Expand Up @@ -13569,7 +13576,7 @@ exports[`<MenuTrigger /> - 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;"
>
<div
Expand Down Expand Up @@ -13740,7 +13747,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with style 1`]
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
style={
Expand Down Expand Up @@ -13769,7 +13776,7 @@ exports[`<MenuTrigger /> - 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",
Expand Down Expand Up @@ -15509,6 +15516,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with variant 1`
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -15780,7 +15788,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with variant 1`
data-padded="true"
data-placement="bottom-start"
data-round="50"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -15950,7 +15958,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with variant 1`
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={50}
showArrow={false}
>
Expand All @@ -15974,7 +15982,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with variant 1`
data-placement="bottom-start"
data-round={50}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down Expand Up @@ -17709,6 +17717,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with zIndex 1`]
onClickOutside={[Function]}
onKeyDown={[Function]}
placement="bottom-start"
role="generic"
setInstance={[Function]}
showArrow={false}
trigger="click"
Expand Down Expand Up @@ -17984,7 +17993,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with zIndex 1`]
data-padded="true"
data-placement="bottom-start"
data-round="75"
role="dialog"
role="generic"
>
<div
class="md-menu-wrapper"
Expand Down Expand Up @@ -18154,7 +18163,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with zIndex 1`]
isPadded={true}
onKeyDown={[Function]}
placement="bottom-start"
role="dialog"
role="generic"
round={75}
showArrow={false}
>
Expand All @@ -18178,7 +18187,7 @@ exports[`<MenuTrigger /> - Enzyme snapshot should match snapshot with zIndex 1`]
data-placement="bottom-start"
data-round={75}
onKeyDown={[Function]}
role="dialog"
role="generic"
>
<_Menu
key=".$2"
Expand Down

0 comments on commit bd0d5db

Please sign in to comment.