@@ -4,16 +4,20 @@ var extend = uiRouter.extend;
44var forEach = uiRouter . forEach ;
55var services = uiRouter . services ;
66var UrlMatcher = uiRouter . UrlMatcher ;
7- var obj = require ( './util/testUtilsNg1' ) . obj ;
8- var resolvedError = require ( './util/testUtilsNg1' ) . resolvedError ;
9- var resolvedValue = require ( './util/testUtilsNg1' ) . resolvedValue ;
10- var html5Compat = require ( './util/testUtilsNg1' ) . html5Compat ;
7+
8+ var testUtils = require ( './util/testUtilsNg1' ) ;
9+ var obj = testUtils . obj ;
10+ var resolvedError = testUtils . resolvedError ;
11+ var resolvedValue = testUtils . resolvedValue ;
12+ var html5Compat = testUtils . html5Compat ;
13+ var decorateExceptionHandler = testUtils . decorateExceptionHandler ;
1114
1215describe ( 'state' , function ( ) {
1316
1417 var $uiRouter , $injector , $stateProvider , locationProvider , templateParams , template , ctrlName , errors ;
1518
16- beforeEach ( module ( 'ui.router' , function ( $locationProvider , $uiRouterProvider ) {
19+ beforeEach ( module ( 'ui.router' , function ( $exceptionHandlerProvider , $locationProvider , $uiRouterProvider ) {
20+ decorateExceptionHandler ( $exceptionHandlerProvider ) ;
1721 errors = [ ] ;
1822 locationProvider = $locationProvider ;
1923 $locationProvider . html5Mode ( false ) ;
@@ -1202,7 +1206,9 @@ describe('state', function () {
12021206
12031207 // TODO: Enforce by default in next major release (1.0.0)
12041208 describe ( 'non-optional parameters' , function ( ) {
1205- it ( "should cause transition failure, when unspecified." , inject ( function ( $state , $transitions , $q ) {
1209+ it ( "should cause transition failure, when unspecified." , inject ( function ( $state , $transitions , $q , $exceptionHandler ) {
1210+ $exceptionHandler . disabled = true ;
1211+
12061212 var count = 0 ;
12071213 $transitions . onEnter ( { entering : 'OPT' } , function ( ) { count ++ } ) ;
12081214 $transitions . onEnter ( { entering : 'OPT.OPT2' } , function ( ) { count ++ } ) ;
@@ -1382,7 +1388,9 @@ describe('state', function () {
13821388 expect ( $state . current . name ) . toBe ( "about" ) ;
13831389 } ) ) ;
13841390
1385- it ( 'should ignore bad state parameters' , inject ( function ( $state , $rootScope , $location , $stateParams ) {
1391+ it ( 'should ignore bad state parameters' , inject ( function ( $state , $rootScope , $location , $stateParams , $exceptionHandler ) {
1392+ $exceptionHandler . disabled = true ;
1393+
13861394 $state . go ( "badParam" , { param : 5 } ) ;
13871395 $rootScope . $apply ( ) ;
13881396 expect ( $state . current . name ) . toBe ( "badParam" ) ;
@@ -1456,15 +1464,19 @@ describe('state', function () {
14561464 expect ( $stateParams . myparam ) . toBe ( 1 ) ;
14571465 } ) ) ;
14581466
1459- it ( 'should not transition if a required non-url parameter is missing' , inject ( function ( $state , $q , $stateParams ) {
1467+ it ( 'should not transition if a required non-url parameter is missing' , inject ( function ( $state , $q , $exceptionHandler ) {
1468+ $exceptionHandler . disabled = true ;
1469+
14601470 $state . transitionTo ( A ) ; $q . flush ( ) ;
14611471 expect ( $state . current . name ) . toBe ( "A" ) ;
14621472
14631473 $state . go ( 'URLLESS' ) ; $q . flush ( ) ; // Missing required parameter; transition fails
14641474 expect ( $state . current . name ) . toBe ( "A" ) ;
14651475 } ) ) ;
14661476
1467- it ( 'should not transition if a required non-url parameter is invalid' , inject ( function ( $state , $q , $stateParams ) {
1477+ it ( 'should not transition if a required non-url parameter is invalid' , inject ( function ( $state , $q , $exceptionHandler ) {
1478+ $exceptionHandler . disabled = true ;
1479+
14681480 $state . transitionTo ( A ) ; $q . flush ( ) ;
14691481 expect ( $state . current . name ) . toBe ( "A" ) ;
14701482
0 commit comments