@@ -4,16 +4,20 @@ var extend = uiRouter.extend;
4
4
var forEach = uiRouter . forEach ;
5
5
var services = uiRouter . services ;
6
6
var 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 ;
11
14
12
15
describe ( 'state' , function ( ) {
13
16
14
17
var $uiRouter , $injector , $stateProvider , locationProvider , templateParams , template , ctrlName , errors ;
15
18
16
- beforeEach ( module ( 'ui.router' , function ( $locationProvider , $uiRouterProvider ) {
19
+ beforeEach ( module ( 'ui.router' , function ( $exceptionHandlerProvider , $locationProvider , $uiRouterProvider ) {
20
+ decorateExceptionHandler ( $exceptionHandlerProvider ) ;
17
21
errors = [ ] ;
18
22
locationProvider = $locationProvider ;
19
23
$locationProvider . html5Mode ( false ) ;
@@ -1202,7 +1206,9 @@ describe('state', function () {
1202
1206
1203
1207
// TODO: Enforce by default in next major release (1.0.0)
1204
1208
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
+
1206
1212
var count = 0 ;
1207
1213
$transitions . onEnter ( { entering : 'OPT' } , function ( ) { count ++ } ) ;
1208
1214
$transitions . onEnter ( { entering : 'OPT.OPT2' } , function ( ) { count ++ } ) ;
@@ -1382,7 +1388,9 @@ describe('state', function () {
1382
1388
expect ( $state . current . name ) . toBe ( "about" ) ;
1383
1389
} ) ) ;
1384
1390
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
+
1386
1394
$state . go ( "badParam" , { param : 5 } ) ;
1387
1395
$rootScope . $apply ( ) ;
1388
1396
expect ( $state . current . name ) . toBe ( "badParam" ) ;
@@ -1456,15 +1464,19 @@ describe('state', function () {
1456
1464
expect ( $stateParams . myparam ) . toBe ( 1 ) ;
1457
1465
} ) ) ;
1458
1466
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
+
1460
1470
$state . transitionTo ( A ) ; $q . flush ( ) ;
1461
1471
expect ( $state . current . name ) . toBe ( "A" ) ;
1462
1472
1463
1473
$state . go ( 'URLLESS' ) ; $q . flush ( ) ; // Missing required parameter; transition fails
1464
1474
expect ( $state . current . name ) . toBe ( "A" ) ;
1465
1475
} ) ) ;
1466
1476
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
+
1468
1480
$state . transitionTo ( A ) ; $q . flush ( ) ;
1469
1481
expect ( $state . current . name ) . toBe ( "A" ) ;
1470
1482
0 commit comments