@@ -19,7 +19,7 @@ import * as helper from "../helper";
1919import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout" ;
2020import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout" ;
2121import { View , PercentLength , Observable , unsetValue , EventData , isIOS } from "tns-core-modules/ui/core/view" ;
22- import { Frame } from "tns-core-modules/ui/frame" ;
22+ import { Frame , stack } from "tns-core-modules/ui/frame" ;
2323import { Label } from "tns-core-modules/ui/label" ;
2424import { Color } from "tns-core-modules/color" ;
2525
@@ -548,6 +548,7 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
548548 let ready = false ;
549549
550550 const modalCloseCallback = function ( returnValue : any ) {
551+ TKUnit . assertEqual ( stack ( ) . length , 1 , "Single frame should be instantiated at this point!" ) ;
551552 ready = true ;
552553 }
553554
@@ -567,6 +568,10 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
567568 hostNavigatedFromCount ++ ;
568569 } ;
569570
571+ const modalPageShownModallyEventHandler = function ( ) {
572+ TKUnit . assertEqual ( stack ( ) . length , 1 , "Single frame should be instantiated at this point!" ) ;
573+ }
574+
570575 const hostNavigatedToEventHandler2 = function ( args : NavigatedData ) {
571576 const page = < Page > args . object ;
572577 page . off ( Page . navigatedToEvent , hostNavigatedToEventHandler2 ) ;
@@ -576,7 +581,11 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
576581 moduleName : basePath + "modal-page"
577582 } ;
578583
584+ TKUnit . assertEqual ( stack ( ) . length , 1 , "Single frame should be instantiated at this point!" ) ;
585+
579586 const modalPage = createViewFromEntry ( entry ) as Page ;
587+ modalPage . on ( Frame . shownModallyEvent , modalPageShownModallyEventHandler ) ;
588+
580589 page . showModal ( modalPage , { } , modalCloseCallback , false , false ) ;
581590 }
582591
@@ -694,6 +703,7 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
694703 let ready = false ;
695704
696705 const modalCloseCallback = function ( returnValue : any ) {
706+ TKUnit . assertEqual ( stack ( ) . length , 1 , "Single frame should be instantiated at this point!" ) ;
697707 ready = true ;
698708 }
699709
@@ -703,6 +713,7 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
703713
704714 const modalFrameShownModallyEventHandler = function ( args : ShownModallyData ) {
705715 shownModallyCount ++ ;
716+ TKUnit . assertEqual ( stack ( ) . length , 2 , "Host and modal frame should be instantiated at this point!" ) ;
706717
707718 args . closeCallback ( "return value" ) ;
708719 }
@@ -720,11 +731,15 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
720731
721732 const modalPage = createViewFromEntry ( entry ) as Page ;
722733
734+ TKUnit . assertEqual ( stack ( ) . length , 1 , "Single frame should be instantiated at this point!" ) ;
735+
723736 modalFrame = new Frame ( ) ;
724737 modalFrame . on ( Frame . showingModallyEvent , modalFrameShowingModallyEventHandler ) ;
725738 modalFrame . on ( Frame . shownModallyEvent , modalFrameShownModallyEventHandler ) ;
726739 modalFrame . navigate ( ( ) => modalPage ) ;
727740
741+ TKUnit . assertEqual ( stack ( ) . length , 2 , "Host and modal frame should be instantiated at this point!" ) ;
742+
728743 page . showModal ( modalFrame , { } , modalCloseCallback , false , false ) ;
729744 }
730745
0 commit comments