@@ -15,6 +15,7 @@ const mainPageCssFileName = "./app/main-page.css";
1515const mainPageHtmlFileName = "./app/main-page.html" ;
1616const mainPageXmlFileName = "./app/main-page.xml" ;
1717
18+ const black = new Color ( "black" ) ;
1819const green = new Color ( "green" ) ;
1920
2021const mainPageTemplate = `
@@ -56,7 +57,7 @@ export function test_onLiveSync_ModuleContext_Script_AppTs() {
5657}
5758
5859export function test_onLiveSync_ModuleContext_Style_MainPageCss ( ) {
59- _test_onLiveSync_ModuleContext ( { type : "style" , path : mainPageCssFileName } ) ;
60+ _test_onLiveSync_ModuleContext_TypeStyle ( { type : "style" , path : mainPageCssFileName } ) ;
6061}
6162
6263export function test_onLiveSync_ModuleContext_Markup_MainPageHtml ( ) {
@@ -110,4 +111,29 @@ function _test_onLiveSync_ModuleContext(context: { type, path }) {
110111 const topmostFrame = frame . topmost ( ) ;
111112 TKUnit . waitUntilReady ( ( ) => topmostFrame . currentPage && topmostFrame . currentPage . isLoaded && ! topmostFrame . canGoBack ( ) ) ;
112113 TKUnit . assertTrue ( topmostFrame . currentPage . getViewById ( "label" ) . isLoaded ) ;
114+ }
115+
116+ function _test_onLiveSync_ModuleContext_TypeStyle ( context : { type , path } ) {
117+ const pageBeforeNavigation = helper . getCurrentPage ( ) ;
118+
119+ const page = < Page > parse ( pageTemplate ) ;
120+ helper . navigateWithHistory ( ( ) => page ) ;
121+
122+ const pageBeforeLiveSync = helper . getCurrentPage ( ) ;
123+ pageBeforeLiveSync . _moduleName = "main-page" ;
124+ global . __onLiveSync ( { type : context . type , path : context . path } ) ;
125+
126+ const pageAfterLiveSync = helper . getCurrentPage ( ) ;
127+ TKUnit . waitUntilReady ( ( ) => pageAfterLiveSync . getViewById ( "button" ) . style . color . toString ( ) === green . toString ( ) ) ;
128+
129+ TKUnit . assertTrue ( pageAfterLiveSync . frame . canGoBack ( ) , "Local styles NOT applied - livesync navigation executed!" ) ;
130+ TKUnit . assertEqual ( pageAfterLiveSync , pageBeforeLiveSync , "Pages are different - livesync navigation executed!" ) ;
131+ TKUnit . assertTrue ( pageAfterLiveSync . _cssState . isSelectorsLatestVersionApplied ( ) , "Latest selectors version NOT applied!" ) ;
132+
133+ helper . goBack ( ) ;
134+
135+ const pageAfterNavigationBack = helper . getCurrentPage ( ) ;
136+ TKUnit . assertEqual ( pageAfterNavigationBack . getViewById ( "label" ) . style . color , black , "App styles applied on back navigation!" ) ;
137+ TKUnit . assertEqual ( pageBeforeNavigation , pageAfterNavigationBack , "Pages are different - livesync navigation executed!" ) ;
138+ TKUnit . assertTrue ( pageAfterNavigationBack . _cssState . isSelectorsLatestVersionApplied ( ) , "Latest selectors version is NOT applied!" ) ;
113139}
0 commit comments