@@ -176,9 +176,9 @@ describe('state', function () {
176
176
return jasmine . getEnv ( ) . currentSpec . $injector . get ( what ) ;
177
177
}
178
178
179
- function initStateTo ( state , optionalParams ) {
179
+ function initStateTo ( state , optionalParams , optionalOptions ) {
180
180
var $state = $get ( '$state' ) , $q = $get ( '$q' ) ;
181
- $state . transitionTo ( state , optionalParams || { } ) ;
181
+ $state . transitionTo ( state , optionalParams || { } , optionalOptions || { } ) ;
182
182
$q . flush ( ) ;
183
183
expect ( $state . current ) . toBe ( state ) ;
184
184
}
@@ -211,7 +211,7 @@ describe('state', function () {
211
211
initStateTo ( RS ) ;
212
212
$location . search ( { term : 'hello' } ) ;
213
213
var called ;
214
- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
214
+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
215
215
called = true
216
216
} ) ;
217
217
$q . flush ( ) ;
@@ -223,7 +223,7 @@ describe('state', function () {
223
223
initStateTo ( RS ) ;
224
224
$location . search ( { term : 'hello' } ) ;
225
225
var called ;
226
- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
226
+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
227
227
called = true
228
228
} ) ;
229
229
$q . flush ( ) ;
@@ -235,7 +235,7 @@ describe('state', function () {
235
235
initStateTo ( RS ) ;
236
236
var called ;
237
237
$state . go ( "." , { term : 'goodbye' } ) ;
238
- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
238
+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
239
239
called = true
240
240
} ) ;
241
241
$q . flush ( ) ;
@@ -248,7 +248,7 @@ describe('state', function () {
248
248
initStateTo ( RSP , { doReload : 'foo' } ) ;
249
249
expect ( $state . params . doReload ) . toEqual ( 'foo' ) ;
250
250
var called ;
251
- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
251
+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
252
252
called = true
253
253
} ) ;
254
254
$state . transitionTo ( RSP , { doReload : 'bar' } ) ;
@@ -264,19 +264,20 @@ describe('state', function () {
264
264
} ) ) ;
265
265
266
266
it ( 'triggers $stateChangeStart' , inject ( function ( $state , $q , $rootScope ) {
267
- initStateTo ( E , { i : 'iii' } ) ;
267
+ initStateTo ( E , { i : 'iii' } , { anOption : true } ) ;
268
268
var called ;
269
- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
269
+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
270
270
expect ( from ) . toBe ( E ) ;
271
271
expect ( fromParams ) . toEqual ( { i : 'iii' } ) ;
272
272
expect ( to ) . toBe ( D ) ;
273
273
expect ( toParams ) . toEqual ( { x : '1' , y : '2' } ) ;
274
+ expect ( options . anOption ) . toBe ( false ) ;
274
275
275
276
expect ( $state . current ) . toBe ( from ) ; // $state not updated yet
276
277
expect ( $state . params ) . toEqual ( fromParams ) ;
277
278
called = true ;
278
279
} ) ;
279
- $state . transitionTo ( D , { x : '1' , y : '2' } ) ;
280
+ $state . transitionTo ( D , { x : '1' , y : '2' } , { anOption : false } ) ;
280
281
$q . flush ( ) ;
281
282
expect ( called ) . toBeTruthy ( ) ;
282
283
expect ( $state . current ) . toBe ( D ) ;
0 commit comments