@@ -29,7 +29,7 @@ const CSS_CLASS_DISABLED = 'igx-drop-down__item--disabled';
2929const CSS_CLASS_HEADER = 'igx-drop-down__header' ;
3030const CSS_CLASS_TABS = '.igx-tabs__header-item' ;
3131
32- describe ( 'IgxDropDown ' , ( ) => {
32+ fdescribe ( 'IgxDropDown ' , ( ) => {
3333 let fixture ;
3434 let dropdown : IgxDropDownComponent ;
3535 describe ( 'Unit tests' , ( ) => {
@@ -1034,6 +1034,56 @@ describe('IgxDropDown ', () => {
10341034 } ) ;
10351035 } ) ;
10361036 describe ( 'Rendering' , ( ) => {
1037+ describe ( 'Accessibility' , ( ) => {
1038+ beforeEach ( waitForAsync ( ( ) => {
1039+ TestBed . configureTestingModule ( {
1040+ imports : [
1041+ NoopAnimationsModule ,
1042+ IgxDropDownTestComponent ,
1043+ ]
1044+ } ) . compileComponents ( ) ;
1045+ } ) ) ;
1046+ beforeEach ( ( ) => {
1047+ fixture = TestBed . createComponent ( IgxDropDownTestComponent ) ;
1048+ fixture . detectChanges ( ) ;
1049+ dropdown = fixture . componentInstance . dropDown ;
1050+ } ) ;
1051+ it ( 'should set the aria-label property correctly' , ( ) => {
1052+ fixture = TestBed . createComponent ( IgxDropDownTestComponent ) ;
1053+ fixture . detectChanges ( ) ;
1054+ dropdown = fixture . componentInstance . dropdown ;
1055+
1056+ // Initially aria-label should be null
1057+ dropdown . toggle ( ) ;
1058+ fixture . detectChanges ( ) ;
1059+ let items = document . querySelectorAll ( `.${ CSS_CLASS_ITEM } ` ) ;
1060+ items . forEach ( item => {
1061+ expect ( item . getAttribute ( 'aria-label' ) ) . toBeNull ( ) ;
1062+ } ) ;
1063+
1064+ // Set value and check if aria-label reflects it
1065+ dropdown . toggle ( ) ;
1066+ fixture . detectChanges ( ) ;
1067+ dropdown . items . forEach ( ( item , index ) => item . value = `value ${ index } ` ) ;
1068+ dropdown . toggle ( ) ;
1069+ fixture . detectChanges ( ) ;
1070+ items = document . querySelectorAll ( `.${ CSS_CLASS_ITEM } ` ) ;
1071+ items . forEach ( ( item , index ) => {
1072+ expect ( item . getAttribute ( 'aria-label' ) ) . toBe ( `value ${ index } ` ) ;
1073+ } ) ;
1074+
1075+ // Phase 3: Set explicit ariaLabel and verify it overrides value
1076+ dropdown . toggle ( ) ;
1077+ fixture . detectChanges ( ) ;
1078+ dropdown . items . forEach ( ( item , index ) => item . ariaLabel = `label ${ index } ` ) ;
1079+ dropdown . toggle ( ) ;
1080+ fixture . detectChanges ( ) ;
1081+ items = document . querySelectorAll ( `.${ CSS_CLASS_ITEM } ` ) ;
1082+ items . forEach ( ( item , index ) => {
1083+ expect ( item . getAttribute ( 'aria-label' ) ) . toBe ( `label ${ index } ` ) ;
1084+ } ) ;
1085+ } ) ;
1086+ } ) ;
10371087 describe ( 'Grouped items' , ( ) => {
10381088 beforeEach ( waitForAsync ( ( ) => {
10391089 TestBed . configureTestingModule ( {
0 commit comments