ui-test added

This commit is contained in:
Vladimir Enchev
2015-07-08 15:41:02 +03:00
parent f478c619d8
commit 85e15e6af0
10 changed files with 78 additions and 1 deletions

View File

@ -0,0 +1,3 @@
.MyStackLayout {
background-color: red;
}

View File

@ -0,0 +1,24 @@
import observable = require("data/observable");
import stackLayoutModule = require("ui/layouts/stack-layout");
import label = require("ui/label");
import button = require("ui/button");
export class MyControl extends stackLayoutModule.StackLayout {
constructor() {
super();
var counter: number = 0;
var lbl = new label.Label();
var btn = new button.Button();
btn.text = "Tap me!";
btn.on(button.Button.tapEvent, (args: observable.EventData) => {
lbl.text = "Tap " + counter++;
});
this.addChild(lbl);
this.addChild(btn);
this.cssClass = "MyStackLayout";
}
}

View File

@ -0,0 +1,2 @@
{ "name" : "MyControl",
"main" : "MyControl.js" }

View File

@ -0,0 +1,3 @@
.MySecondCustomStackLayout {
background-color: green;
}

View File

@ -0,0 +1,16 @@
import observable = require("data/observable");
import view = require("ui/core/view");
import label = require("ui/label");
var count = 0;
export function buttonTap2(args: observable.EventData) {
count++;
var parent = (<view.View>args.object).parent;
if (parent) {
var lbl = parent.getViewById<label.Label>("Label1");
if (lbl) {
lbl.text = "You clicked " + count + " times!";
}
}
}

View File

@ -0,0 +1,4 @@
<StackLayout xmlns:customControls="xml-declaration/mymodule" cssClass="MySecondCustomStackLayout">
<Label id="Label1" text="mymodulewithxml" />
<Button text="Click!" tap="buttonTap2" />
</StackLayout>

View File

@ -0,0 +1,2 @@
{ "name" : "MyControl",
"main" : "MyControl.js" }

View File

@ -0,0 +1,7 @@
<Page xmlns:customControls="custom-components/mymodule"
xmlns:customControls2="custom-components/mymodulewithxml">
<StackLayout>
<customControls:MyControl />
<customControls2:MyControl />
</StackLayout>
</Page>

View File

@ -10,7 +10,7 @@ import trace = require("trace");
trace.enable();
trace.setCategories(trace.categories.Test);
var list: string[] = ["pages", "layouts", "modal-view", "bindings"];
var list: string[] = ["pages", "layouts", "modal-view", "bindings", "custom-components"];
// basePath is auto-changed when building multiple apps
var basePath = "";