mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #862 from NativeScript/backstack
Fixed the navigation tests.
This commit is contained in:
@@ -3,7 +3,7 @@ import pageModule = require("ui/page");
|
||||
import frame = require("ui/frame");
|
||||
|
||||
export var test_backstackVisible = function() {
|
||||
var pageFactory = function (): pageModule.Page {
|
||||
var pageFactory = function(): pageModule.Page {
|
||||
return new pageModule.Page();
|
||||
};
|
||||
|
||||
@@ -33,11 +33,15 @@ export var test_backstackVisible = function() {
|
||||
|
||||
// Clearing the history messes up the tests app.
|
||||
//export var test_ClearHistory = function () {
|
||||
// var pageFactory = function (): pageModule.Page {
|
||||
// var pageFactory = function(): pageModule.Page {
|
||||
// return new pageModule.Page();
|
||||
// };
|
||||
|
||||
// var mainTestPage = frame.topmost().currentPage;
|
||||
// var mainPageFactory = function(): pageModule.Page {
|
||||
// return mainTestPage;
|
||||
// };
|
||||
|
||||
// var currentPage: pageModule.Page;
|
||||
|
||||
// currentPage = frame.topmost().currentPage;
|
||||
@@ -62,4 +66,7 @@ export var test_backstackVisible = function() {
|
||||
|
||||
// TKUnit.assert(!frame.topmost().canGoBack(), "Frame should NOT be able to go back.");
|
||||
// TKUnit.assert(frame.topmost().backStack.length === 0, "Back stack should have 0 entries.");
|
||||
|
||||
// frame.topmost().navigate({ create: mainPageFactory });
|
||||
// TKUnit.waitUntilReady(() => { return frame.topmost().currentPage === mainTestPage; });
|
||||
//}
|
||||
@@ -80,13 +80,15 @@ 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");
|
||||
allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
|
||||
|
||||
if (!isRunningOnEmulator()) {
|
||||
allTests["LOCATION"] = require("./location-tests");
|
||||
}
|
||||
|
||||
// Navigation tests should always be last.
|
||||
allTests["NAVIGATION"] = require("./navigation-tests");
|
||||
|
||||
import utils = require("utils/utils");
|
||||
var density = utils.layout.getDisplayDensity();
|
||||
utils.layout.getDisplayDensity = function () {
|
||||
|
||||
@@ -184,7 +184,6 @@ export class Frame extends view.CustomLayoutView implements definition.Frame {
|
||||
var entry = this._navigationQueue[0].entry;
|
||||
var currentNavigationPage = entry.resolvedPage;
|
||||
if (page !== currentNavigationPage) {
|
||||
console.trace();
|
||||
throw new Error(`Corrupted navigation stack; page: ${page.id}; currentNavigationPage: ${currentNavigationPage.id}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,9 +216,6 @@ export class Frame extends frameCommon.Frame {
|
||||
public _navigateCore(backstackEntry: definition.BackstackEntry) {
|
||||
trace.write(`_navigateCore; id: ${backstackEntry.resolvedPage.id}; backstackVisible: ${this._isEntryBackstackVisible(backstackEntry)}; clearHistory: ${backstackEntry.entry.clearHistory};`, trace.categories.Navigation);
|
||||
|
||||
//this._printFrameBackStack();
|
||||
//this._printNativeBackStack();
|
||||
|
||||
var activity = this._android.activity;
|
||||
if (!activity) {
|
||||
// We do not have an Activity yet associated. In this case we have two execution paths:
|
||||
@@ -300,9 +297,7 @@ export class Frame extends frameCommon.Frame {
|
||||
}
|
||||
|
||||
// Add to backStack if needed.
|
||||
if (this.backStack.length > 0 &&
|
||||
this._currentEntry &&
|
||||
this._isEntryBackstackVisible(this._currentEntry)) {
|
||||
if (this.backStack.length > 0 && this._currentEntry) {
|
||||
// We add each entry in the backstack to avoid the "Stack corrupted" mismatch
|
||||
var backstackTag = this._currentEntry[BACKSTACK_TAG];
|
||||
fragmentTransaction.addToBackStack(backstackTag);
|
||||
@@ -327,11 +322,6 @@ export class Frame extends frameCommon.Frame {
|
||||
|
||||
fragmentTransaction.commit();
|
||||
trace.write("fragmentTransaction.commit();", trace.categories.NativeLifecycle);
|
||||
|
||||
//setTimeout(() => {
|
||||
// this._printFrameBackStack();
|
||||
// this._printNativeBackStack();
|
||||
//}, 100);
|
||||
}
|
||||
|
||||
public _goBackCore(backstackEntry: definition.BackstackEntry) {
|
||||
|
||||
Reference in New Issue
Block a user