@@ -1046,13 +1046,9 @@ describe('IgxDropDown ', () => {
1046
1046
beforeEach ( ( ) => {
1047
1047
fixture = TestBed . createComponent ( IgxDropDownTestComponent ) ;
1048
1048
fixture . detectChanges ( ) ;
1049
- dropdown = fixture . componentInstance . dropDown ;
1049
+ dropdown = fixture . componentInstance . dropdown ;
1050
1050
} ) ;
1051
1051
it ( 'should set the aria-label property correctly' , ( ) => {
1052
- fixture = TestBed . createComponent ( IgxDropDownTestComponent ) ;
1053
- fixture . detectChanges ( ) ;
1054
- dropdown = fixture . componentInstance . dropdown ;
1055
-
1056
1052
// Initially aria-label should be null
1057
1053
dropdown . toggle ( ) ;
1058
1054
fixture . detectChanges ( ) ;
@@ -1083,6 +1079,35 @@ describe('IgxDropDown ', () => {
1083
1079
expect ( item . getAttribute ( 'aria-label' ) ) . toBe ( `label ${ index } ` ) ;
1084
1080
} ) ;
1085
1081
} ) ;
1082
+ it ( 'should update aria-activedescendant to the id of the focused item' , fakeAsync ( ( ) => {
1083
+ dropdown . toggle ( ) ;
1084
+ tick ( ) ;
1085
+ fixture . detectChanges ( ) ;
1086
+
1087
+ const dropdownElement = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_DROP_DOWN_BASE } ` ) ) . nativeElement ;
1088
+ let focusedItem = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_FOCUSED } ` ) ) . nativeElement ;
1089
+
1090
+ expect ( focusedItem ) . toBeTruthy ( ) ;
1091
+ let focusedItemId = focusedItem . getAttribute ( 'id' ) ;
1092
+ expect ( focusedItemId ) . toBeTruthy ( ) ;
1093
+ expect ( dropdownElement . getAttribute ( 'aria-activedescendant' ) ) . toBe ( focusedItemId ) ;
1094
+
1095
+ dropdown . toggle ( ) ;
1096
+ tick ( ) ;
1097
+ fixture . detectChanges ( ) ;
1098
+ dropdown . toggle ( ) ;
1099
+ tick ( ) ;
1100
+ fixture . detectChanges ( ) ;
1101
+
1102
+ UIInteractions . triggerEventHandlerKeyDown ( 'ArrowDown' , fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_DROP_DOWN_BASE } ` ) ) ) ;
1103
+ tick ( ) ;
1104
+ fixture . detectChanges ( ) ;
1105
+
1106
+ focusedItem = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_FOCUSED } ` ) ) . nativeElement ;
1107
+ focusedItemId = focusedItem . getAttribute ( 'id' ) ;
1108
+
1109
+ expect ( dropdownElement . getAttribute ( 'aria-activedescendant' ) ) . toBe ( focusedItemId ) ;
1110
+ } ) ) ;
1086
1111
} ) ;
1087
1112
describe ( 'Grouped items' , ( ) => {
1088
1113
beforeEach ( waitForAsync ( ( ) => {
0 commit comments