@@ -2468,7 +2468,8 @@ describe('$mdPanel', function() {
24682468 spyOn ( obj , 'callback' ) ;
24692469
24702470 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
2471- callInterceptors ( 'CLOSE' ) ;
2471+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2472+ flushPanel ( ) ;
24722473
24732474 expect ( obj . callback ) . toHaveBeenCalledWith ( panelRef ) ;
24742475 } ) ;
@@ -2482,8 +2483,9 @@ describe('$mdPanel', function() {
24822483 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 1 ) ) ;
24832484 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 2 ) ) ;
24842485 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 3 ) ) ;
2485- callInterceptors ( 'CLOSE' ) . then ( obj . callback ) ;
2486- $rootScope . $apply ( ) ;
2486+
2487+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . then ( obj . callback ) ;
2488+ flushPanel ( ) ;
24872489
24882490 expect ( results ) . toEqual ( [ 3 , 2 , 1 ] ) ;
24892491 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
@@ -2507,8 +2509,8 @@ describe('$mdPanel', function() {
25072509 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 2 ) ) ;
25082510 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 3 ) ) ;
25092511
2510- callInterceptors ( ' CLOSE' ) . catch ( obj . callback ) ;
2511- $rootScope . $apply ( ) ;
2512+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . catch ( obj . callback ) ;
2513+ flushPanel ( ) ;
25122514
25132515 expect ( results ) . toEqual ( [ 3 , 2 ] ) ;
25142516 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
@@ -2535,8 +2537,8 @@ describe('$mdPanel', function() {
25352537 return $q . resolve ( ) ;
25362538 } ) ;
25372539
2538- callInterceptors ( ' CLOSE' ) . catch ( obj . callback ) ;
2539- $rootScope . $apply ( ) ;
2540+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . catch ( obj . callback ) ;
2541+ flushPanel ( ) ;
25402542
25412543 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
25422544 } ) ;
@@ -2546,8 +2548,8 @@ describe('$mdPanel', function() {
25462548
25472549 spyOn ( obj , 'callback' ) ;
25482550
2549- callInterceptors ( ' CLOSE' ) . then ( obj . callback ) ;
2550- $rootScope . $apply ( ) ;
2551+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . then ( obj . callback ) ;
2552+ flushPanel ( ) ;
25512553
25522554 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
25532555 } ) ;
@@ -2558,8 +2560,8 @@ describe('$mdPanel', function() {
25582560 spyOn ( obj , 'callback' ) ;
25592561
25602562 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
2561-
2562- callInterceptors ( 'CLOSE' ) ;
2563+ panelRef . _callInterceptors ( interceptorTypes . CLOSE )
2564+ flushPanel ( ) ;
25632565
25642566 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
25652567
@@ -2582,16 +2584,17 @@ describe('$mdPanel', function() {
25822584 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
25832585 panelRef . registerInterceptor ( 'onOpen' , obj . otherCallback ) ;
25842586
2585- callInterceptors ( 'CLOSE' ) ;
2586- callInterceptors ( 'onOpen' ) ;
2587+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2588+ panelRef . _callInterceptors ( 'onOpen' ) ;
2589+ flushPanel ( ) ;
25872590
25882591 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
25892592 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
25902593
25912594 panelRef . removeAllInterceptors ( ) ;
25922595
2593- callInterceptors ( ' CLOSE' ) ;
2594- callInterceptors ( 'onOpen' ) ;
2596+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2597+ panelRef . _callInterceptors ( 'onOpen' ) ;
25952598
25962599 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
25972600 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -2609,16 +2612,18 @@ describe('$mdPanel', function() {
26092612 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
26102613 panelRef . registerInterceptor ( 'onOpen' , obj . otherCallback ) ;
26112614
2612- callInterceptors ( 'CLOSE' ) ;
2613- callInterceptors ( 'onOpen' ) ;
2615+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2616+ panelRef . _callInterceptors ( 'onOpen' ) ;
2617+ flushPanel ( ) ;
26142618
26152619 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
26162620 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
26172621
26182622 panelRef . removeAllInterceptors ( interceptorTypes . CLOSE ) ;
26192623
2620- callInterceptors ( 'CLOSE' ) ;
2621- callInterceptors ( 'onOpen' ) ;
2624+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2625+ panelRef . _callInterceptors ( 'onOpen' ) ;
2626+ flushPanel ( ) ;
26222627
26232628 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
26242629 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 2 ) ;
@@ -2746,17 +2751,6 @@ describe('$mdPanel', function() {
27462751 $material . flushOutstandingAnimations ( ) ;
27472752 }
27482753
2749- function callInterceptors ( type ) {
2750- if ( panelRef ) {
2751- var promise = panelRef . _callInterceptors (
2752- $mdPanel . interceptorTypes [ type ] || type
2753- ) ;
2754-
2755- flushPanel ( ) ;
2756- return promise ;
2757- }
2758- }
2759-
27602754 function getNumberOfGroups ( ) {
27612755 return Object . keys ( $mdPanel . _groups ) . length ;
27622756 }
0 commit comments