@@ -14,16 +14,18 @@ import {Transition} from "../../src/transition/transition";
1414
1515describe ( 'transition' , function ( ) {
1616
17- var transitionProvider , matcher , pathFactory , statesMap , queue ;
17+ var $exceptionHandler , transitionProvider , matcher , pathFactory , statesMap , queue ;
1818
1919 var targetState = function ( identifier , params = { } , options ?) {
2020 options = options || { } ;
2121 var stateDefinition = matcher . find ( identifier , options . relative ) ;
2222 return new TargetState ( identifier , stateDefinition , params , options ) ;
2323 } ;
2424
25- beforeEach ( module ( 'ui.router' , function ( $transitionsProvider , $urlMatcherFactoryProvider ) {
25+ beforeEach ( module ( 'ui.router' , function ( $transitionsProvider , $urlMatcherFactoryProvider , $exceptionHandlerProvider ) {
26+ decorateExceptionHandler ( $exceptionHandlerProvider ) ;
2627 transitionProvider = $transitionsProvider ;
28+
2729 var stateTree = {
2830 first : { } ,
2931 second : { } ,
@@ -71,7 +73,8 @@ describe('transition', function () {
7173
7274 var makeTransition ;
7375
74- beforeEach ( inject ( function ( $transitions , $state ) {
76+ beforeEach ( inject ( function ( $transitions , $state , _$exceptionHandler_ ) {
77+ $exceptionHandler = _$exceptionHandler_ ;
7578 matcher = new StateMatcher ( statesMap ) ;
7679 queue . flush ( $state ) ;
7780 makeTransition = function makeTransition ( from , to , options ) {
@@ -113,6 +116,7 @@ describe('transition', function () {
113116
114117 it ( '$transition$.promise should reject on error' , inject ( function ( $transitions , $q ) {
115118 var result = new PromiseResult ( ) ;
119+ $exceptionHandler . disabled = true ;
116120
117121 transitionProvider . onStart ( { from : "*" , to : "third" } , function ( $transition$ ) {
118122 result . setPromise ( $transition$ . promise ) ;
@@ -126,6 +130,7 @@ describe('transition', function () {
126130
127131 it ( '$transition$.promise should reject on error in synchronous hooks' , inject ( function ( $transitions , $q ) {
128132 var result = new PromiseResult ( ) ;
133+ $exceptionHandler . disabled = true ;
129134
130135 transitionProvider . onBefore ( { from : "*" , to : "third" } , function ( $transition$ ) {
131136 result . setPromise ( $transition$ . promise ) ;
@@ -298,6 +303,7 @@ describe('transition', function () {
298303 } ) ) ;
299304
300305 it ( 'should be called even if other .onSuccess() callbacks fail (throw errors, etc)' , inject ( function ( $transitions , $q ) {
306+ $exceptionHandler . disabled = true ;
301307 transitionProvider . onSuccess ( { from : "*" , to : "*" } , function ( ) { throw new Error ( "oops!" ) ; } ) ;
302308 transitionProvider . onSuccess ( { from : "*" , to : "*" } , function ( trans ) { states . push ( trans . to ( ) . name ) ; } ) ;
303309
@@ -318,6 +324,7 @@ describe('transition', function () {
318324 } ) ) ;
319325
320326 it ( 'should be called if any part of the transition fails.' , inject ( function ( $transitions , $q ) {
327+ $exceptionHandler . disabled = true ;
321328 transitionProvider . onEnter ( { from : "A" , entering : "C" } , function ( ) { throw new Error ( "oops!" ) ; } ) ;
322329 transitionProvider . onError ( { } , function ( trans ) { states . push ( trans . to ( ) . name ) ; } ) ;
323330
@@ -327,6 +334,7 @@ describe('transition', function () {
327334 } ) ) ;
328335
329336 it ( 'should be called for only handlers matching the transition.' , inject ( function ( $transitions , $q ) {
337+ $exceptionHandler . disabled = true ;
330338 transitionProvider . onEnter ( { from : "A" , entering : "C" } , function ( ) { throw new Error ( "oops!" ) ; } ) ;
331339 transitionProvider . onError ( { from : "*" , to : "*" } , function ( ) { hooks . push ( "splatsplat" ) ; } ) ;
332340 transitionProvider . onError ( { from : "A" , to : "C" } , function ( ) { hooks . push ( "AC" ) ; } ) ;
0 commit comments