File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ describe('MDC-based MatMenu', () => {
94
94
fixture . detectChanges ( ) ;
95
95
const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
96
96
97
- expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'true ' ) ;
97
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu ' ) ;
98
98
99
99
fixture . componentInstance . trigger . menu = null ;
100
100
fixture . detectChanges ( ) ;
@@ -142,6 +142,14 @@ describe('MDC-based MatMenu', () => {
142
142
expect ( overlayContainerElement . querySelector ( '.cdk-overlay-backdrop' ) ) . toBeFalsy ( ) ;
143
143
} ) ) ;
144
144
145
+ it ( 'should set the correct aria-haspopup value on the trigger element' , fakeAsync ( ( ) => {
146
+ const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
147
+ fixture . detectChanges ( ) ;
148
+ const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
149
+
150
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu' ) ;
151
+ } ) ) ;
152
+
145
153
it ( 'should be able to remove the backdrop on repeat openings' , fakeAsync ( ( ) => {
146
154
const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
147
155
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ const passiveEventListenerOptions = normalizePassiveListenerOptions({passive: tr
75
75
76
76
@Directive ( {
77
77
host : {
78
- '[attr.aria-haspopup]' : 'menu ? true : null' ,
78
+ '[attr.aria-haspopup]' : 'menu ? "menu" : null' ,
79
79
'[attr.aria-expanded]' : 'menuOpen || null' ,
80
80
'[attr.aria-controls]' : 'menuOpen ? menu.panelId : null' ,
81
81
'(click)' : '_handleClick($event)' ,
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ describe('MatMenu', () => {
94
94
fixture . detectChanges ( ) ;
95
95
const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
96
96
97
- expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'true ' ) ;
97
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu ' ) ;
98
98
99
99
fixture . componentInstance . trigger . menu = null ;
100
100
fixture . detectChanges ( ) ;
@@ -142,6 +142,14 @@ describe('MatMenu', () => {
142
142
expect ( overlayContainerElement . querySelector ( '.cdk-overlay-backdrop' ) ) . toBeFalsy ( ) ;
143
143
} ) ) ;
144
144
145
+ it ( 'should set the correct aria-haspopup value on the trigger element' , fakeAsync ( ( ) => {
146
+ const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
147
+ fixture . detectChanges ( ) ;
148
+ const triggerElement = fixture . componentInstance . triggerEl . nativeElement ;
149
+
150
+ expect ( triggerElement . getAttribute ( 'aria-haspopup' ) ) . toBe ( 'menu' ) ;
151
+ } ) ) ;
152
+
145
153
it ( 'should be able to remove the backdrop on repeat openings' , fakeAsync ( ( ) => {
146
154
const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
147
155
fixture . detectChanges ( ) ;
You can’t perform that action at this time.
0 commit comments