Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/components/menuBar/js/menuBarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,8 @@ MenuBarController.prototype.handleParentClick = function(event) {
var openMenu = this.querySelector('md-menu.md-open');

if (openMenu && !openMenu.contains(event.target)) {
angular.element(openMenu).controller('mdMenu').close();
angular.element(openMenu).controller('mdMenu').close(true, {
closeAll: true
});
}
};






9 changes: 8 additions & 1 deletion src/components/menuBar/menu-bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('material.components.menuBar', function() {

it('should close when clicking on the wrapping toolbar', inject(function($compile, $rootScope, $timeout, $material) {
var ctrl = null;
var menuCtrl = null;
var toolbar = $compile(
'<md-toolbar>' +
'<md-menu-bar>' +
Expand All @@ -42,16 +43,22 @@ describe('material.components.menuBar', function() {
attachedMenuElements.push(toolbar); // ensure it gets cleaned up

ctrl = toolbar.find('md-menu-bar').controller('mdMenuBar');
menuCtrl = toolbar.find('md-menu').eq(0).controller('mdMenu');

toolbar.find('md-menu').eq(0).controller('mdMenu').open();
menuCtrl.open();
$timeout.flush();

expect(toolbar).toHaveClass('md-has-open-menu');
spyOn(menuCtrl, 'close').and.callThrough();

toolbar.triggerHandler('click');
$material.flushInterimElement(); // flush out the scroll mask

expect(toolbar).not.toHaveClass('md-has-open-menu');
expect(ctrl.getOpenMenuIndex()).toBe(-1);
expect(menuCtrl.close).toHaveBeenCalledWith(true, {
closeAll: true
});
}));

describe('ARIA', function() {
Expand Down