@@ -365,6 +365,49 @@ describe('<md-autocomplete>', function() {
365
365
element . remove ( ) ;
366
366
} ) ) ;
367
367
368
+ it ( 'should remove the md-scroll-mask on cleanup' , inject ( function ( $mdUtil , $timeout , $material ) {
369
+ spyOn ( $mdUtil , 'enableScrolling' ) ;
370
+
371
+ var scope = createScope ( ) ;
372
+ var template =
373
+ '<md-autocomplete' +
374
+ ' md-selected-item="selectedItem"' +
375
+ ' md-search-text="searchText"' +
376
+ ' md-items="item in match(searchText)"' +
377
+ ' md-item-text="item.display"' +
378
+ ' placeholder="placeholder">' +
379
+ ' <md-item-template>{{item.display}}</md-item-template>' +
380
+ ' <md-not-found>Sorry, not found...</md-not-found>' +
381
+ '</md-autocomplete>' ;
382
+ var element = compile ( template , scope ) ;
383
+ var ctrl = element . controller ( 'mdAutocomplete' ) ;
384
+
385
+ $material . flushOutstandingAnimations ( ) ;
386
+
387
+ // Focus our input
388
+ ctrl . focus ( ) ;
389
+
390
+ // Set our search text to a value that we know doesn't exist
391
+ scope . searchText = 'somethingthatdoesnotexist' ;
392
+
393
+ // Run our initial flush
394
+ $timeout . flush ( ) ;
395
+ waitForVirtualRepeat ( element ) ;
396
+
397
+ // Wait for the next tick when the values will be updated
398
+ $timeout . flush ( ) ;
399
+
400
+ expect ( ctrl . hidden ) . toBeFalsy ( ) ;
401
+
402
+ // Make sure we wrap up anything and remove the element
403
+ $timeout . flush ( ) ;
404
+ element . remove ( ) ;
405
+ scope . $destroy ( ) ;
406
+
407
+ // Should be hidden on once the scope is destroyed to ensure proper cleanup (like md-scroll-mask is removed from the DOM)
408
+ expect ( $mdUtil . enableScrolling ) . toHaveBeenCalled ( ) ;
409
+ } ) ) ;
410
+
368
411
it ( 'should ensure the parent scope digests along with the current scope' , inject ( function ( $timeout , $material ) {
369
412
var scope = createScope ( null , { bang : 'boom' } ) ;
370
413
var template =
0 commit comments