@@ -631,6 +631,7 @@ describe('Integration', () => {
631631 advance ( fixture ) ;
632632 expect ( fixture . nativeElement ) . toHaveText ( 'team 33 [ , right: ]' ) ;
633633 } ) ) ) ;
634+
634635 it ( 'should eagerly update the URL with urlUpdateStrategy="eagar"' ,
635636 fakeAsync ( inject ( [ Router , Location ] , ( router : Router , location : Location ) => {
636637 const fixture = TestBed . createComponent ( RootCmp ) ;
@@ -722,6 +723,33 @@ describe('Integration', () => {
722723 expect ( fixture . nativeElement ) . toHaveText ( 'team 33 [ , right: ]' ) ;
723724 } ) ) ) ;
724725
726+ it ( 'should should set `state` with urlUpdateStrategy="eagar"' ,
727+ fakeAsync ( inject ( [ Router , Location ] , ( router : Router , location : SpyLocation ) => {
728+
729+ router . urlUpdateStrategy = 'eager' ;
730+ router . resetConfig ( [
731+ { path : '' , component : SimpleCmp } ,
732+ { path : 'simple' , component : SimpleCmp } ,
733+ ] ) ;
734+
735+ const fixture = createRoot ( router , RootCmp ) ;
736+ let navigation : Navigation = null ! ;
737+ router . events . subscribe ( e => {
738+ if ( e instanceof NavigationStart ) {
739+ navigation = router . getCurrentNavigation ( ) ! ;
740+ }
741+ } ) ;
742+
743+ router . navigateByUrl ( '/simple' , { state : { foo : 'bar' } } ) ;
744+ tick ( ) ;
745+
746+ const history = ( location as any ) . _history ;
747+ expect ( history [ history . length - 1 ] . state . foo ) . toBe ( 'bar' ) ;
748+ expect ( history [ history . length - 1 ] . state )
749+ . toEqual ( { foo : 'bar' , navigationId : history . length } ) ;
750+ expect ( navigation . extras . state ) . toBeDefined ( ) ;
751+ expect ( navigation . extras . state ) . toEqual ( { foo : 'bar' } ) ;
752+ } ) ) ) ;
725753 } ) ;
726754
727755 it ( 'should navigate back and forward' ,
0 commit comments