@@ -2239,7 +2239,8 @@ describe('$mdPanel', function() {
22392239 spyOn ( obj , 'callback' ) ;
22402240
22412241 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
2242- callInteceptors ( 'CLOSE' ) ;
2242+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2243+ flushPanel ( ) ;
22432244
22442245 expect ( obj . callback ) . toHaveBeenCalledWith ( panelRef ) ;
22452246 } ) ;
@@ -2254,8 +2255,8 @@ describe('$mdPanel', function() {
22542255 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 2 ) ) ;
22552256 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 3 ) ) ;
22562257
2257- callInteceptors ( ' CLOSE' ) . then ( obj . callback ) ;
2258- $rootScope . $apply ( ) ;
2258+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . then ( obj . callback ) ;
2259+ flushPanel ( ) ;
22592260
22602261 expect ( results ) . toEqual ( [ 3 , 2 , 1 ] ) ;
22612262 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
@@ -2279,8 +2280,8 @@ describe('$mdPanel', function() {
22792280 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 2 ) ) ;
22802281 panelRef . registerInterceptor ( interceptorTypes . CLOSE , makePromise ( 3 ) ) ;
22812282
2282- callInteceptors ( ' CLOSE' ) . catch ( obj . callback ) ;
2283- $rootScope . $apply ( ) ;
2283+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . catch ( obj . callback ) ;
2284+ flushPanel ( ) ;
22842285
22852286 expect ( results ) . toEqual ( [ 3 , 2 ] ) ;
22862287 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
@@ -2307,8 +2308,8 @@ describe('$mdPanel', function() {
23072308 return $q . resolve ( ) ;
23082309 } ) ;
23092310
2310- callInteceptors ( ' CLOSE' ) . catch ( obj . callback ) ;
2311- $rootScope . $apply ( ) ;
2311+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . catch ( obj . callback ) ;
2312+ flushPanel ( ) ;
23122313
23132314 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
23142315 } ) ;
@@ -2318,8 +2319,8 @@ describe('$mdPanel', function() {
23182319
23192320 spyOn ( obj , 'callback' ) ;
23202321
2321- callInteceptors ( ' CLOSE' ) . then ( obj . callback ) ;
2322- $rootScope . $apply ( ) ;
2322+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) . then ( obj . callback ) ;
2323+ flushPanel ( ) ;
23232324
23242325 expect ( obj . callback ) . toHaveBeenCalled ( ) ;
23252326 } ) ;
@@ -2330,12 +2331,14 @@ describe('$mdPanel', function() {
23302331 spyOn ( obj , 'callback' ) ;
23312332
23322333 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
2333- callInteceptors ( 'CLOSE' ) ;
2334+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2335+ flushPanel ( ) ;
23342336
23352337 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23362338
23372339 panelRef . removeInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
2338- panelRef . _callInterceptors ( 'CLOSE' ) ;
2340+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2341+ flushPanel ( ) ;
23392342
23402343 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23412344 } ) ;
@@ -2352,15 +2355,17 @@ describe('$mdPanel', function() {
23522355 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
23532356 panelRef . registerInterceptor ( 'onOpen' , obj . otherCallback ) ;
23542357
2355- callInteceptors ( 'CLOSE' ) ;
2356- callInteceptors ( 'onOpen' ) ;
2358+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2359+ panelRef . _callInterceptors ( 'onOpen' ) ;
2360+ flushPanel ( ) ;
23572361
23582362 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23592363 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
23602364
23612365 panelRef . removeAllInterceptors ( ) ;
2362- callInteceptors ( 'CLOSE' ) ;
2363- callInteceptors ( 'onOpen' ) ;
2366+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2367+ panelRef . _callInterceptors ( 'onOpen' ) ;
2368+ flushPanel ( ) ;
23642369
23652370 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23662371 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -2378,15 +2383,17 @@ describe('$mdPanel', function() {
23782383 panelRef . registerInterceptor ( interceptorTypes . CLOSE , obj . callback ) ;
23792384 panelRef . registerInterceptor ( 'onOpen' , obj . otherCallback ) ;
23802385
2381- callInteceptors ( 'CLOSE' ) ;
2382- callInteceptors ( 'onOpen' ) ;
2386+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2387+ panelRef . _callInterceptors ( 'onOpen' ) ;
2388+ flushPanel ( ) ;
23832389
23842390 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23852391 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 1 ) ;
23862392
23872393 panelRef . removeAllInterceptors ( interceptorTypes . CLOSE ) ;
2388- callInteceptors ( 'CLOSE' ) ;
2389- callInteceptors ( 'onOpen' ) ;
2394+ panelRef . _callInterceptors ( interceptorTypes . CLOSE ) ;
2395+ panelRef . _callInterceptors ( 'onOpen' ) ;
2396+ flushPanel ( ) ;
23902397
23912398 expect ( obj . callback ) . toHaveBeenCalledTimes ( 1 ) ;
23922399 expect ( obj . otherCallback ) . toHaveBeenCalledTimes ( 2 ) ;
@@ -2401,7 +2408,8 @@ describe('$mdPanel', function() {
24012408
24022409 expect ( panelRef . isAttached ) . toBe ( true ) ;
24032410
2404- closePanel ( ) ;
2411+ panelRef . close ( ) . catch ( angular . noop ) ;
2412+ flushPanel ( ) ;
24052413
24062414 expect ( panelRef . isAttached ) . toBe ( true ) ;
24072415 } ) ;
@@ -2512,15 +2520,4 @@ describe('$mdPanel', function() {
25122520 $rootScope . $apply ( ) ;
25132521 $material . flushOutstandingAnimations ( ) ;
25142522 }
2515-
2516- function callInteceptors ( type ) {
2517- if ( panelRef ) {
2518- var promise = panelRef . _callInterceptors (
2519- $mdPanel . interceptorTypes [ type ] || type
2520- ) ;
2521-
2522- flushPanel ( ) ;
2523- return promise ;
2524- }
2525- }
25262523} ) ;
0 commit comments