11import * as TKUnit from "../../TKUnit" ;
2- import { Page } from "tns-core-modules/ui/page" ;
2+ import { Page , View } from "tns-core-modules/ui/page" ;
33import { Frame , NavigationEntry , stack } from "tns-core-modules/ui/frame" ;
44import { _resetRootView , getRootView } from "tns-core-modules/application" ;
55import { TabView , TabViewItem } from "tns-core-modules/ui/tab-view" ;
@@ -65,10 +65,42 @@ export function test_gridlayout_rootview_css_applied() {
6565 helper . assertViewBackgroundColor ( rootView , "#0000FF" ) ;
6666} ;
6767
68+ export function test_gridlayout_rootview_layout_updates ( ) {
69+ layout_invalidate_test ( "ui/root-view/root-modules/gridlayout-root" ) ;
70+ }
71+
72+ export function test_custom_component_rootview_layout_updates ( ) {
73+ layout_invalidate_test ( "ui/root-view/root-modules/custom-component-root" ) ;
74+ }
75+
76+ export function test_tabview_rootview_layout_updates ( ) {
77+ layout_invalidate_test ( "ui/root-view/root-modules/gridlayout-root" ) ;
78+ }
79+
80+ function layout_invalidate_test ( moduleName : string ) {
81+ var entry = { moduleName } ;
82+
83+ _resetRootView ( entry ) ;
84+
85+ var rootView = getRootView ( ) ;
86+ TKUnit . waitUntilReady ( ( ) => rootView . isLayoutValid ) ;
87+
88+ const lbl = < View > rootView . getViewById ( "my-test-label" ) ;
89+
90+ lbl . visibility = "collapse" ;
91+ TKUnit . assertFalse ( rootView . isLayoutValid ) ;
92+ TKUnit . waitUntilReady ( ( ) => rootView . isLayoutValid ) ;
93+
94+ lbl . visibility = "visible" ;
95+ TKUnit . assertFalse ( rootView . isLayoutValid ) ;
96+ TKUnit . waitUntilReady ( ( ) => rootView . isLayoutValid ) ;
97+ TKUnit . waitUntilReady ( ( ) => lbl . isLayoutValid ) ;
98+ }
99+
68100export function tearDownModule ( ) {
69101 // reset the root to frame for other tests
70102 const resetFrameRoot = createTestFrameRootEntry ( ) ;
71103
72104 _resetRootView ( resetFrameRoot . entry ) ;
73105 TKUnit . waitUntilReady ( ( ) => resetFrameRoot . page . isLoaded ) ;
74- }
106+ }
0 commit comments