Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(menu): ensure menu button is type=button
Browse files Browse the repository at this point in the history
closes #3821
  • Loading branch information
rschmukler committed Jul 20, 2015
1 parent 976e0f4 commit d203d72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/menu/_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function MenuDirective($mdMenu) {
triggerElement = triggerElement.querySelector('[ng-click]');
}
triggerElement && triggerElement.setAttribute('aria-haspopup', 'true');
triggerElement.setAttribute('type', 'button');
if (templateElement.children().length != 2) {
throw Error('Invalid HTML for md-menu. Expected two children elements.');
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/menu/menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ describe('md-menu directive', function () {
expect(buildBadMenu).toThrow();
}));


it('removes everything but the first element', function () {
var menu = setup()[0];
expect(menu.children.length).toBe(1);
expect(menu.firstElementChild.nodeName).toBe('BUTTON');
});

iit('specifies button type', inject(function($compile, $rootScope) {
var menu = setup()[0];
expect(menu.firstElementChild.getAttribute('type')).toBe('button');
}));

it('opens on click', function () {
var menu = setup();
openMenu(menu);
Expand Down

0 comments on commit d203d72

Please sign in to comment.