Skip to content

Commit

Permalink
fix(menuBar): test leaking scroll mask element (angular#9569)
Browse files Browse the repository at this point in the history
Fixes one of the menuBar specs which wasn't flushing out the interim element, which caused it to leak scroll mask elements.
  • Loading branch information
crisbeto authored and ThomasBurleson committed Sep 10, 2016
1 parent a95d76d commit c5b5386
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/menuBar/menu-bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('material.components.menuBar', function() {
expect(nestedMenu.getAttribute('md-position-mode')).toBe('left bottom');
});

it('should close when clicking on the wrapping toolbar', inject(function($compile, $rootScope, $timeout) {
it('should close when clicking on the wrapping toolbar', inject(function($compile, $rootScope, $timeout, $material) {
var ctrl = null;
var toolbar = $compile(
'<md-toolbar>' +
Expand All @@ -39,13 +39,16 @@ describe('material.components.menuBar', function() {
)($rootScope);

$rootScope.$digest();
attachedMenuElements.push(toolbar); // ensure it gets cleaned up

ctrl = toolbar.find('md-menu-bar').controller('mdMenuBar');

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

expect(toolbar).toHaveClass('md-has-open-menu');
toolbar.triggerHandler('click');
$material.flushInterimElement(); // flush out the scroll mask

expect(toolbar).not.toHaveClass('md-has-open-menu');
expect(ctrl.getOpenMenuIndex()).toBe(-1);
Expand Down

0 comments on commit c5b5386

Please sign in to comment.