mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Added a unit test for backstackVisible
This commit is contained in:
@ -143,6 +143,7 @@
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="apps\animations\model.ts" />
|
||||
<TypeScriptCompile Include="apps\orientation-demo\main-page.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\navigation-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\animation\animation-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\search-bar\search-bar-tests-native.android.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\search-bar\search-bar-tests-native.d.ts" />
|
||||
@ -1950,7 +1951,7 @@
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
32
apps/tests/navigation-tests.ts
Normal file
32
apps/tests/navigation-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import TKUnit = require("./TKUnit");
|
||||
import pageModule = require("ui/page");
|
||||
import frame = require("ui/frame");
|
||||
|
||||
export var test_backstackVisible = function() {
|
||||
var pageFactory = function (): pageModule.Page {
|
||||
return new pageModule.Page();
|
||||
};
|
||||
|
||||
var mainTestPage = frame.topmost().currentPage;
|
||||
frame.topmost().navigate({ create: pageFactory });
|
||||
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== mainTestPage; });
|
||||
|
||||
// page1 should not be added to the backstack
|
||||
var page0 = frame.topmost().currentPage;
|
||||
frame.topmost().navigate({ create: pageFactory, backstackVisible: false });
|
||||
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== page0; });
|
||||
|
||||
var page1 = frame.topmost().currentPage;
|
||||
frame.topmost().navigate({ create: pageFactory });
|
||||
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== page1; });
|
||||
|
||||
var page2 = frame.topmost().currentPage;
|
||||
frame.topmost().goBack();
|
||||
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== page2; });
|
||||
|
||||
// From page2 we have to go directly to page0, skipping page1.
|
||||
TKUnit.assert(frame.topmost().currentPage === page0, "Page 1 should be skipped when going back.");
|
||||
|
||||
frame.topmost().goBack();
|
||||
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage === mainTestPage; });
|
||||
}
|
@ -79,6 +79,7 @@ allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
|
||||
allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
|
||||
allTests["CONNECTIVITY"] = require("./connectivity-tests");
|
||||
allTests["ANIMATION"] = require("./ui/animation/animation-tests");
|
||||
allTests["NAVIGATION"] = require("./navigation-tests");
|
||||
|
||||
if (!isRunningOnEmulator()) {
|
||||
allTests["LOCATION"] = require("./location-tests");
|
||||
|
Reference in New Issue
Block a user