@@ -176,9 +176,9 @@ describe('state', function () {
176176 return jasmine . getEnv ( ) . currentSpec . $injector . get ( what ) ;
177177 }
178178
179- function initStateTo ( state , optionalParams ) {
179+ function initStateTo ( state , optionalParams , optionalOptions ) {
180180 var $state = $get ( '$state' ) , $q = $get ( '$q' ) ;
181- $state . transitionTo ( state , optionalParams || { } ) ;
181+ $state . transitionTo ( state , optionalParams || { } , optionalOptions || { } ) ;
182182 $q . flush ( ) ;
183183 expect ( $state . current ) . toBe ( state ) ;
184184 }
@@ -211,7 +211,7 @@ describe('state', function () {
211211 initStateTo ( RS ) ;
212212 $location . search ( { term : 'hello' } ) ;
213213 var called ;
214- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
214+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
215215 called = true
216216 } ) ;
217217 $q . flush ( ) ;
@@ -223,7 +223,7 @@ describe('state', function () {
223223 initStateTo ( RS ) ;
224224 $location . search ( { term : 'hello' } ) ;
225225 var called ;
226- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
226+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
227227 called = true
228228 } ) ;
229229 $q . flush ( ) ;
@@ -235,7 +235,7 @@ describe('state', function () {
235235 initStateTo ( RS ) ;
236236 var called ;
237237 $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 ) {
239239 called = true
240240 } ) ;
241241 $q . flush ( ) ;
@@ -248,7 +248,7 @@ describe('state', function () {
248248 initStateTo ( RSP , { doReload : 'foo' } ) ;
249249 expect ( $state . params . doReload ) . toEqual ( 'foo' ) ;
250250 var called ;
251- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
251+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
252252 called = true
253253 } ) ;
254254 $state . transitionTo ( RSP , { doReload : 'bar' } ) ;
@@ -264,19 +264,20 @@ describe('state', function () {
264264 } ) ) ;
265265
266266 it ( 'triggers $stateChangeStart' , inject ( function ( $state , $q , $rootScope ) {
267- initStateTo ( E , { i : 'iii' } ) ;
267+ initStateTo ( E , { i : 'iii' } , { anOption : true } ) ;
268268 var called ;
269- $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams ) {
269+ $rootScope . $on ( '$stateChangeStart' , function ( ev , to , toParams , from , fromParams , options ) {
270270 expect ( from ) . toBe ( E ) ;
271271 expect ( fromParams ) . toEqual ( { i : 'iii' } ) ;
272272 expect ( to ) . toBe ( D ) ;
273273 expect ( toParams ) . toEqual ( { x : '1' , y : '2' } ) ;
274+ expect ( options . anOption ) . toBe ( false ) ;
274275
275276 expect ( $state . current ) . toBe ( from ) ; // $state not updated yet
276277 expect ( $state . params ) . toEqual ( fromParams ) ;
277278 called = true ;
278279 } ) ;
279- $state . transitionTo ( D , { x : '1' , y : '2' } ) ;
280+ $state . transitionTo ( D , { x : '1' , y : '2' } , { anOption : false } ) ;
280281 $q . flush ( ) ;
281282 expect ( called ) . toBeTruthy ( ) ;
282283 expect ( $state . current ) . toBe ( D ) ;
0 commit comments