Skip to content

Commit c5b5386

Browse files
crisbetoThomasBurleson
authored andcommitted
fix(menuBar): test leaking scroll mask element (angular#9569)
Fixes one of the menuBar specs which wasn't flushing out the interim element, which caused it to leak scroll mask elements.
1 parent a95d76d commit c5b5386

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/menuBar/menu-bar.spec.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('material.components.menuBar', function() {
2525
expect(nestedMenu.getAttribute('md-position-mode')).toBe('left bottom');
2626
});
2727

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

4141
$rootScope.$digest();
42+
attachedMenuElements.push(toolbar); // ensure it gets cleaned up
43+
4244
ctrl = toolbar.find('md-menu-bar').controller('mdMenuBar');
4345

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

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

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

0 commit comments

Comments
 (0)