@@ -626,6 +626,55 @@ describe('Toolbar', () => {
626626 expect ( item2 . getAttribute ( 'aria-pressed' ) ) . toBe ( 'false' ) ;
627627 } ) ;
628628 } ) ;
629+
630+ describe ( 'ARIA attributes and roles' , ( ) => {
631+ beforeEach ( ( ) => setupToolbar ( ) ) ;
632+
633+ it ( 'should have role="toolbar"' , ( ) => {
634+ expect ( toolbarElement . getAttribute ( 'role' ) ) . toBe ( 'toolbar' ) ;
635+ } ) ;
636+
637+ it ( 'should set aria-orientation based on input' , ( ) => {
638+ expect ( toolbarElement . getAttribute ( 'aria-orientation' ) ) . toBe ( 'horizontal' ) ;
639+ fixture . componentInstance . orientation . set ( 'vertical' ) ;
640+ fixture . detectChanges ( ) ;
641+ expect ( toolbarElement . getAttribute ( 'aria-orientation' ) ) . toBe ( 'vertical' ) ;
642+ } ) ;
643+
644+ it ( 'should set aria-disabled based on input' , ( ) => {
645+ expect ( toolbarElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'false' ) ;
646+ fixture . componentInstance . disabled . set ( true ) ;
647+ fixture . detectChanges ( ) ;
648+ expect ( toolbarElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
649+ } ) ;
650+ } ) ;
651+
652+ describe ( 'Focus management' , ( ) => {
653+ beforeEach ( ( ) => setupToolbar ( ) ) ;
654+
655+ it ( 'should have tabindex on widgets set by active state' , ( ) => {
656+ const widgets = getWidgetEls ( ) ;
657+ expect ( widgets [ 0 ] . getAttribute ( 'tabindex' ) ) . toBe ( '0' ) ;
658+ expect ( widgets [ 1 ] . getAttribute ( 'tabindex' ) ) . toBe ( '-1' ) ;
659+
660+ click ( widgets [ 1 ] ) ;
661+ expect ( widgets [ 0 ] . getAttribute ( 'tabindex' ) ) . toBe ( '-1' ) ;
662+ expect ( widgets [ 1 ] . getAttribute ( 'tabindex' ) ) . toBe ( '0' ) ;
663+ } ) ;
664+ } ) ;
665+
666+ describe ( 'Hard disabled state attributes' , ( ) => {
667+ beforeEach ( ( ) => setupToolbar ( { softDisabled : false } ) ) ;
668+
669+ it ( 'should set inert and disabled attributes on hard-disabled widgets' , ( ) => {
670+ fixture . componentInstance . widgets [ 0 ] . disabled . set ( true ) ;
671+ fixture . detectChanges ( ) ;
672+
673+ const widgets = getWidgetEls ( ) ;
674+ expect ( widgets [ 0 ] . hasAttribute ( 'inert' ) ) . toBe ( true ) ;
675+ expect ( widgets [ 0 ] . getAttribute ( 'disabled' ) ) . toBe ( 'true' ) ;
676+ } ) ;
677+ } ) ;
629678} ) ;
630679
631680@Component ( {
0 commit comments