mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Update console module test page.
This commit is contained in:
@@ -627,7 +627,6 @@
|
|||||||
<Content Include="apps\tests\xml-declaration\mymodulewithxml\my-control-no-js.xml">
|
<Content Include="apps\tests\xml-declaration\mymodulewithxml\my-control-no-js.xml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="apps\ui-tests-app\pages\console.xml" />
|
|
||||||
<Content Include="apps\ui-tests-app\pages\i86.xml" />
|
<Content Include="apps\ui-tests-app\pages\i86.xml" />
|
||||||
<Content Include="apps\template-blank\app.css" />
|
<Content Include="apps\template-blank\app.css" />
|
||||||
<Content Include="apps\template-hello-world\app.css" />
|
<Content Include="apps\template-hello-world\app.css" />
|
||||||
|
|||||||
@@ -1,29 +1,78 @@
|
|||||||
export function pageLoaded() {
|
import pageModule = require("ui/page");
|
||||||
|
import labelModule = require("ui/label");
|
||||||
|
import stackLayoutModule = require("ui/layouts/stack-layout");
|
||||||
|
import textViewModule = require("ui/text-view");
|
||||||
|
import buttonModule = require("ui/button");
|
||||||
|
|
||||||
|
export function createPage() {
|
||||||
|
|
||||||
|
var stackLayout = new stackLayoutModule.StackLayout();
|
||||||
|
var label = new labelModule.Label();
|
||||||
|
label.text = "CONSOLE MODULE";
|
||||||
|
var textView = new textViewModule.TextView();
|
||||||
|
textView.text = "Check out the console output.";
|
||||||
|
stackLayout.addChild(label);
|
||||||
|
stackLayout.addChild(textView);
|
||||||
|
|
||||||
|
var page = new pageModule.Page();
|
||||||
|
page.on(pageModule.Page.loadedEvent, function () {
|
||||||
|
pageLoaded();
|
||||||
|
});
|
||||||
|
|
||||||
|
page.content = stackLayout;
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pageLoaded() {
|
||||||
|
|
||||||
console.log("### TEST START ###");
|
console.log("### TEST START ###");
|
||||||
onTapTrue();
|
console.time("Time");
|
||||||
onTapFalse();
|
|
||||||
onTapText();
|
var undef;
|
||||||
onTapNull();
|
var num = -1;
|
||||||
onTapUndefined();
|
var str = "text";
|
||||||
|
var obj = { name: "John", age: 34 };
|
||||||
|
var button = new buttonModule.Button();
|
||||||
|
function Foo() {
|
||||||
|
this.abc = "Hello";
|
||||||
|
this.circular = this;
|
||||||
|
}
|
||||||
|
var foo = new Foo();
|
||||||
|
|
||||||
|
console.log(true);
|
||||||
|
console.log(false);
|
||||||
|
console.log(null);
|
||||||
|
console.log(undef);
|
||||||
|
|
||||||
|
console.log(num);
|
||||||
|
console.log(str);
|
||||||
|
console.log(obj);
|
||||||
|
|
||||||
|
console.log('number: %i', num);
|
||||||
|
console.log('string: %s', str);
|
||||||
|
console.log("%s %f", str, num);
|
||||||
|
|
||||||
|
console.info("info");
|
||||||
|
console.warn("warn");
|
||||||
|
console.error("error");
|
||||||
|
|
||||||
|
console.assert(0 === 1, "%d not equals %d", 0, 1);
|
||||||
|
console.assert(1 === 1, "1 equals 1");
|
||||||
|
|
||||||
|
console.dump(true);
|
||||||
|
console.dump(false);
|
||||||
|
console.dump(null);
|
||||||
|
console.dump(undef);
|
||||||
|
|
||||||
|
console.dump(num);
|
||||||
|
console.dump(str);
|
||||||
|
|
||||||
|
console.dir(obj);
|
||||||
|
console.dump(foo);
|
||||||
|
console.trace();
|
||||||
|
|
||||||
|
console.log("%j", button);
|
||||||
|
|
||||||
|
console.timeEnd("Time");
|
||||||
console.log("### TEST END ###");
|
console.log("### TEST END ###");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function onTapTrue() {
|
|
||||||
console.log(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onTapFalse() {
|
|
||||||
console.log(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onTapText() {
|
|
||||||
console.log("text");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onTapNull() {
|
|
||||||
console.log(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onTapUndefined() {
|
|
||||||
console.log(undefined);
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
|
|
||||||
<StackLayout orientation="vertical">
|
|
||||||
<Label text="console.log()" id="label" />
|
|
||||||
<Button text="true" tap="onTapTrue" />
|
|
||||||
<Button text="false" tap="onTapFalse" />
|
|
||||||
<Button text="text" tap="onTapText" />
|
|
||||||
<Button text="null" tap="onTapNull" />
|
|
||||||
<Button text="undefined" tap="onTapUndefined" />
|
|
||||||
</StackLayout>
|
|
||||||
</Page>
|
|
||||||
Reference in New Issue
Block a user