File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,14 @@ describe('MDC-based MatMenu', () => {
122
122
expect ( overlayContainerElement . querySelector ( '.cdk-overlay-backdrop' ) ) . toBeFalsy ( ) ;
123
123
} ) ) ;
124
124
125
+ it ( 'should set the correct aria-haspopup value on the trigger element' , fakeAsync ( ( ) => {
126
+ const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
127
+ fixture . detectChanges ( ) ;
128
+ const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
129
+
130
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu' ) ;
131
+ } ) ) ;
132
+
125
133
it ( 'should be able to remove the backdrop on repeat openings' , fakeAsync ( ( ) => {
126
134
const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
127
135
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ const passiveEventListenerOptions = normalizePassiveListenerOptions({passive: tr
74
74
selector : `[mat-menu-trigger-for], [matMenuTriggerFor]` ,
75
75
host : {
76
76
'class' : 'mat-menu-trigger' ,
77
- 'aria-haspopup' : 'true ' ,
77
+ 'aria-haspopup' : 'menu ' ,
78
78
'[attr.aria-expanded]' : 'menuOpen || null' ,
79
79
'[attr.aria-controls]' : 'menuOpen ? menu.panelId : null' ,
80
80
'(mousedown)' : '_handleMousedown($event)' ,
Original file line number Diff line number Diff line change @@ -124,6 +124,14 @@ describe('MatMenu', () => {
124
124
expect ( overlayContainerElement . querySelector ( '.cdk-overlay-backdrop' ) ) . toBeFalsy ( ) ;
125
125
} ) ) ;
126
126
127
+ it ( 'should set the correct aria-haspopup value on the trigger element' , fakeAsync ( ( ) => {
128
+ const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
129
+ fixture . detectChanges ( ) ;
130
+ const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
131
+
132
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu' ) ;
133
+ } ) ) ;
134
+
127
135
it ( 'should be able to remove the backdrop on repeat openings' , fakeAsync ( ( ) => {
128
136
const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
129
137
fixture . detectChanges ( ) ;
You can’t perform that action at this time.
0 commit comments