@@ -11,6 +11,7 @@ import createWrapper from '../../../lib/components/test-utils/dom';
11
11
import { isItemGroup , isLinkItem } from '../utils/utils' ;
12
12
13
13
import categoryStyles from '../../../lib/components/button-dropdown/category-elements/styles.css.js' ;
14
+ import categoryItemStyles from '../../../lib/components/button-dropdown/category-elements/styles.css.js' ;
14
15
import itemStyles from '../../../lib/components/button-dropdown/item-element/styles.css.js' ;
15
16
import iconStyles from '../../../lib/components/icon/styles.css.js' ;
16
17
import optionsListStyles from '../../../lib/components/internal/components/options-list/styles.css.js' ;
@@ -23,7 +24,7 @@ const renderButtonDropdown = (props: ButtonDropdownProps) => {
23
24
const checkRenderedGroup = (
24
25
renderedItem : ElementWrapper ,
25
26
group : ButtonDropdownProps . ItemGroup ,
26
- parentIsDisabled = false
27
+ parentIsDisabled : boolean
27
28
) => {
28
29
const element = renderedItem . getElement ( ) ;
29
30
@@ -37,7 +38,12 @@ const checkRenderedGroup = (
37
38
38
39
if ( parentIsDisabled || group . disabled ) {
39
40
expect ( element ) . toHaveClass ( `${ categoryStyles . disabled } ` ) ;
40
- expect ( element ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
41
+ if ( group . disabled ) {
42
+ expect ( element . querySelector ( `.${ categoryItemStyles [ 'items-list-container' ] } ` ) ) . toHaveAttribute (
43
+ 'aria-disabled' ,
44
+ 'true'
45
+ ) ;
46
+ }
41
47
}
42
48
} ;
43
49
@@ -88,7 +94,7 @@ const checkRenderedItems = (
88
94
89
95
expect ( renderedItems . length ) . toBe ( items . length ) ;
90
96
91
- Array . prototype . forEach . call ( renderedItems , ( renderedItem , index ) => {
97
+ renderedItems . forEach ( ( renderedItem : ElementWrapper , index : number ) => {
92
98
const item = items [ index ] ;
93
99
94
100
if ( isItemGroup ( item ) ) {
0 commit comments