@@ -9,7 +9,7 @@ import { device, isIOS } from "platform";
99
1010import { ComponentFixture , async } from "@angular/core/testing" ;
1111import { nsTestBedRender , nsTestBedAfterEach , nsTestBedBeforeEach } from "nativescript-angular/testing" ;
12- import { NSLocationStrategy } from "nativescript-angular/router/ns-location-strategy" ;
12+ import { NSLocationStrategy , Outlet } from "nativescript-angular/router/ns-location-strategy" ;
1313import { FrameService } from "nativescript-angular" ;
1414import { FakeFrameService } from "./ns-location-strategy" ;
1515const CLOSE_WAIT = isIOS ? 1000 : 0 ;
@@ -47,7 +47,11 @@ export class FailComponent {
4747 </GridLayout>`
4848} )
4949export class SuccessComponent {
50- constructor ( public service : ModalDialogService , public vcRef : ViewContainerRef ) {
50+ constructor (
51+ public service : ModalDialogService ,
52+ public vcRef : ViewContainerRef ,
53+ public locationStrategy : NSLocationStrategy ,
54+ public fakeFrameService : FrameService ) {
5155 }
5256}
5357
@@ -88,6 +92,16 @@ describe("modal-dialog", () => {
8892 nsTestBedRender ( SuccessComponent )
8993 . then ( ( fixture : ComponentFixture < SuccessComponent > ) => {
9094 const service = < ModalDialogService > fixture . componentRef . instance . service ;
95+ const locStrategy = < NSLocationStrategy > fixture . componentRef . instance . locationStrategy ;
96+ const outlet = new Outlet ( "primary" , "primary" , 0 ) ;
97+
98+ let parentView = fixture . componentRef . instance . vcRef . element . nativeElement ;
99+ parentView = parentView . page && parentView . page . frame ;
100+ outlet . frame = parentView ;
101+ locStrategy . outlets . push ( outlet ) ;
102+
103+ locStrategy . pushState ( null , "test" , "/test" , null ) ;
104+
91105 const comp = < SuccessComponent > fixture . componentRef . instance ;
92106 return service . showModal ( ModalComponent , { viewContainerRef : comp . vcRef } ) ;
93107 } )
@@ -100,6 +114,16 @@ describe("modal-dialog", () => {
100114 nsTestBedRender ( SuccessComponent )
101115 . then ( ( fixture : ComponentFixture < SuccessComponent > ) => {
102116 const service = < ModalDialogService > fixture . componentRef . instance . service ;
117+ const locStrategy = < NSLocationStrategy > fixture . componentRef . instance . locationStrategy ;
118+ const outlet = new Outlet ( "primary" , "primary" , 0 ) ;
119+
120+ let parentView = fixture . componentRef . instance . vcRef . element . nativeElement ;
121+ parentView = parentView . page && parentView . page . frame ;
122+ outlet . frame = parentView ;
123+ locStrategy . outlets . push ( outlet ) ;
124+
125+ locStrategy . pushState ( null , "test" , "/test" , null ) ;
126+
103127 const comp = < SuccessComponent > fixture . componentRef . instance ;
104128 return service . showModal ( ModalComponent , {
105129 viewContainerRef : comp . vcRef ,
0 commit comments