File tree Expand file tree Collapse file tree 6 files changed +38
-5
lines changed
packages/react/src/components
DataTable/__tests__/__snapshots__ Expand file tree Collapse file tree 6 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -572,7 +572,7 @@ exports[`DataTable behaves as expected selection should render and match snapsho
572
572
aria-expanded = " false"
573
573
aria-haspopup = " true"
574
574
aria-labelledby = " tooltip-:r2m:"
575
- class = " cds--btn--icon-only cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--primary "
575
+ class = " cds--btn--icon-only cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--ghost "
576
576
title = " Settings"
577
577
type = " button"
578
578
>
@@ -1003,7 +1003,7 @@ exports[`DataTable renders as expected - Component API should render and match s
1003
1003
aria-expanded = " false"
1004
1004
aria-haspopup = " true"
1005
1005
aria-labelledby = " tooltip-:rk:"
1006
- class = " cds--btn--icon-only cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--primary "
1006
+ class = " cds--btn--icon-only cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--ghost "
1007
1007
title = " Settings"
1008
1008
type = " button"
1009
1009
>
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ exports[`TableToolbarMenu renders as expected - Component API should render 1`]
15
15
aria-expanded = " false"
16
16
aria-haspopup = " true"
17
17
aria-labelledby = " tooltip-:r0:"
18
- class = " cds--btn--icon-only custom-class cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--primary "
18
+ class = " cds--btn--icon-only custom-class cds--toolbar-action cds--overflow-menu cds--overflow-menu cds--overflow-menu--md cds--btn cds--btn--md cds--layout--size-md cds--btn--ghost "
19
19
title = " Add"
20
20
type = " button"
21
21
>
Original file line number Diff line number Diff line change @@ -37,6 +37,21 @@ describe('OverflowMenu', () => {
37
37
expect ( screen . getByRole ( 'button' ) ) . toHaveAttribute ( 'data-testid' , 'test' ) ;
38
38
} ) ;
39
39
40
+ it ( 'should always use button kind=ghost' , ( ) => {
41
+ render (
42
+ < OverflowMenu
43
+ data-testid = "test"
44
+ aria-label = "Overflow menu"
45
+ className = "extra-class" >
46
+ < OverflowMenuItem className = "test-child" itemText = "one" />
47
+ < OverflowMenuItem className = "test-child" itemText = "two" />
48
+ </ OverflowMenu >
49
+ ) ;
50
+
51
+ expect ( screen . getByRole ( 'button' ) ) . not . toHaveClass ( 'cds--btn--primary' ) ;
52
+ expect ( screen . getByRole ( 'button' ) ) . toHaveClass ( 'cds--btn--ghost' ) ;
53
+ } ) ;
54
+
40
55
it ( 'should flip menu alignment' , async ( ) => {
41
56
render (
42
57
< OverflowMenu
Original file line number Diff line number Diff line change @@ -732,7 +732,8 @@ class OverflowMenu extends React.Component<
732
732
id = { id }
733
733
ref = { mergeRefs ( this . _triggerRef , ref ) }
734
734
size = { size }
735
- label = { iconDescription } >
735
+ label = { iconDescription }
736
+ kind = "ghost" >
736
737
< IconElement { ...iconProps } />
737
738
</ IconButton >
738
739
{ open && this . state . hasMountedTrigger && wrappedMenuBody }
Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ describe('OverflowMenu (enable-v12-overflowmenu)', () => {
86
86
expect ( container . firstChild ) . toHaveAttribute ( 'id' , 'custom-id' ) ;
87
87
} ) ;
88
88
89
+ it ( 'should always use button kind=ghost' , ( ) => {
90
+ render (
91
+ < OverflowMenu >
92
+ < MenuItem label = "item" className = "test-child" >
93
+ one
94
+ </ MenuItem >
95
+ < MenuItem label = "item" className = "test-child" >
96
+ two
97
+ </ MenuItem >
98
+ </ OverflowMenu >
99
+ ) ;
100
+
101
+ expect ( screen . getByRole ( 'button' ) ) . not . toHaveClass ( 'cds--btn--primary' ) ;
102
+ expect ( screen . getByRole ( 'button' ) ) . toHaveClass ( 'cds--btn--ghost' ) ;
103
+ } ) ;
104
+
89
105
it ( 'should close menu on outside click' , async ( ) => {
90
106
render (
91
107
< OverflowMenu >
Original file line number Diff line number Diff line change @@ -189,7 +189,8 @@ const OverflowMenu = React.forwardRef<HTMLDivElement, OverflowMenuProps>(
189
189
onMouseDown = { handleMousedown }
190
190
ref = { floatingRef }
191
191
label = { label }
192
- align = { tooltipAlignment } >
192
+ align = { tooltipAlignment }
193
+ kind = "ghost" >
193
194
< IconElement className = { `${ prefix } --overflow-menu__icon` } />
194
195
</ IconButton >
195
196
< Menu
You can’t perform that action at this time.
0 commit comments