Skip to content

Commit

Permalink
update mdc-based menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Oct 11, 2019
1 parent 1fc8a6f commit 1d4496e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/material-experimental/mdc-menu/menu.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-template>
<div
class="mat-mdc-menu-panel mdc-menu-surface mdc-menu-surface--open"
[id]="panelId"
[ngClass]="_classList"
(keydown)="_handleKeydown($event)"
(click)="closed.emit('click')"
Expand Down
9 changes: 9 additions & 0 deletions src/material-experimental/mdc-menu/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ describe('MatMenu', () => {
overlayContainer.ngOnDestroy();
}));

it('should aria-controls the menu panel', () => {
const fixture = createComponent(SimpleMenu, [], [FakeIcon]);
fixture.detectChanges();
fixture.componentInstance.trigger.openMenu();
fixture.detectChanges();
expect(fixture.componentInstance.triggerEl.nativeElement.getAttribute('aria-controls'))
.toBe(fixture.componentInstance.menu.panelId);
});

it('should open the menu as an idempotent operation', () => {
const fixture = createComponent(SimpleMenu, [], [FakeIcon]);
fixture.detectChanges();
Expand Down

0 comments on commit 1d4496e

Please sign in to comment.