mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Update ui-tests-app.
This commit is contained in:
@ -202,6 +202,8 @@
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\i73.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\gestures.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\listview_binding.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\modal-view\login-page.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\modal-view\modal-view.ts" />
|
||||
<TypeScriptCompile Include="es-collections.d.ts" />
|
||||
<TypeScriptCompile Include="es6-promise.d.ts" />
|
||||
<TypeScriptCompile Include="file-system\file-name-resolver.d.ts" />
|
||||
@ -631,6 +633,8 @@
|
||||
<Content Include="apps\template-hello-world\app.css" />
|
||||
<Content Include="apps\template-master-detail\app.css" />
|
||||
<Content Include="apps\template-tab-navigation\app.css" />
|
||||
<Content Include="apps\ui-tests-app\modal-view\login-page.xml" />
|
||||
<Content Include="apps\ui-tests-app\modal-view\modal-view.xml" />
|
||||
<Content Include="ui\layouts\stack-layout\package.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import application = require("application");
|
||||
application.mainModule = "mainPage";
|
||||
|
||||
|
||||
application.onUncaughtError = function (error: application.NativeScriptError) {
|
||||
console.warn(error.message);
|
||||
if (error.nativeError) {
|
||||
@ -8,63 +9,64 @@ application.onUncaughtError = function (error: application.NativeScriptError) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
application.on(application.launchEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is an android.content.Intent class.
|
||||
console.log("Launched application with: " + args.android + ".");
|
||||
console.log("### Launched application with: " + args.android + ".");
|
||||
} else if (args.ios !== undefined) {
|
||||
// For iOS applications, args.ios is NSDictionary (launchOptions).
|
||||
console.log("Launched application with: " + args.ios);
|
||||
console.log("### Launched application with: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
application.on(application.suspendEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is an android activity class.
|
||||
console.log("SuspendEvent Activity: " + args.android);
|
||||
console.log("### SuspendEvent Activity: " + args.android);
|
||||
} else if (args.ios) {
|
||||
// For iOS applications, args.ios is UIApplication.
|
||||
console.log("SuspendEvent UIApplication: " + args.ios);
|
||||
console.log("### SuspendEvent UIApplication: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
application.on(application.resumeEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is an android activity class.
|
||||
console.log("ResumeEvent Activity: " + args.android);
|
||||
console.log("### ResumeEvent Activity: " + args.android);
|
||||
} else if (args.ios) {
|
||||
// For iOS applications, args.ios is UIApplication.
|
||||
console.log("ResumeEvent UIApplication: " + args.ios);
|
||||
console.log("### ResumeEvent UIApplication: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
application.on(application.exitEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is an android activity class.
|
||||
console.log("ExitEvent Activity: " + args.android);
|
||||
console.log("### ExitEvent Activity: " + args.android);
|
||||
} else if (args.ios) {
|
||||
// For iOS applications, args.ios is UIApplication.
|
||||
console.log("ExitEvent UIApplication: " + args.ios);
|
||||
console.log("### ExitEvent UIApplication: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
application.on(application.lowMemoryEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is an android activity class.
|
||||
console.log("LowMemoryEvent Activity: " + args.android);
|
||||
console.log("### LowMemoryEvent Activity: " + args.android);
|
||||
} else if (args.ios) {
|
||||
// For iOS applications, args.ios is UIApplication.
|
||||
console.log("LowMemoryEvent UIApplication: " + args.ios);
|
||||
console.log("### LowMemoryEvent UIApplication: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
application.on(application.uncaughtErrorEvent, function (args: application.ApplicationEventData) {
|
||||
if (args.android) {
|
||||
// For Android applications, args.android is NativeScriptError.
|
||||
console.log("NativeScriptError: " + args.android);
|
||||
console.log("### NativeScriptError: " + args.android);
|
||||
} else if (args.ios) {
|
||||
// For iOS applications, args.ios is NativeScriptError.
|
||||
console.log("NativeScriptError: " + args.ios);
|
||||
console.log("### NativeScriptError: " + args.ios);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,29 +1,32 @@
|
||||
import pages = require("ui/page");
|
||||
import button = require("ui/button");
|
||||
import trace = require("trace");
|
||||
import gridModule = require("ui/layouts/grid-layout");
|
||||
import text = require("ui/text-view");
|
||||
import frame = require("ui/frame");
|
||||
import button = require("ui/button");
|
||||
import text = require("ui/text-view");
|
||||
import dialogs = require("ui/dialogs");
|
||||
import gridModule = require("ui/layouts/grid-layout");
|
||||
import fs = require("file-system");
|
||||
import trace = require("trace");
|
||||
trace.enable();
|
||||
trace.setCategories(trace.categories.Test);
|
||||
|
||||
export function createPage() {
|
||||
var basePath = "pages/";
|
||||
var txtInput = new text.TextView();
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Run";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var pagePath = basePath + txtInput.text;
|
||||
var fileName = fs.path.join(__dirname, "pages", txtInput.text);
|
||||
|
||||
if ((fs.File.exists(fileName + ".js")) || (fs.File.exists(fileName + ".xml"))) {
|
||||
frame.topmost().navigate(basePath + txtInput.text);
|
||||
var fileName = fs.path.join(__dirname, "pages", txtInput.text);
|
||||
if ((fs.File.exists(fileName + ".xml") || (fs.File.exists(fileName + ".js")))) {
|
||||
frame.topmost().navigate("pages/" + txtInput.text);
|
||||
}
|
||||
else {
|
||||
dialogs.alert("Cannot find page: " + pagePath);
|
||||
var fileName = fs.path.join(__dirname, txtInput.text, txtInput.text);
|
||||
if ((fs.File.exists(fileName + ".xml") || (fs.File.exists(fileName + ".js")))) {
|
||||
frame.topmost().navigate(txtInput.text + "/" + txtInput.text);
|
||||
}
|
||||
else {
|
||||
dialogs.alert("Cannot find page: " + txtInput.text);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user