mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
ui-test added
This commit is contained in:
@ -212,6 +212,10 @@
|
|||||||
<DependentUpon>xmlbasics.xml</DependentUpon>
|
<DependentUpon>xmlbasics.xml</DependentUpon>
|
||||||
</TypeScriptCompile>
|
</TypeScriptCompile>
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\bindings\basics.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\bindings\basics.ts" />
|
||||||
|
<TypeScriptCompile Include="apps\ui-tests-app\custom-components\mymodulewithxml\MyControl.ts">
|
||||||
|
<DependentUpon>MyControl.xml</DependentUpon>
|
||||||
|
</TypeScriptCompile>
|
||||||
|
<TypeScriptCompile Include="apps\ui-tests-app\custom-components\mymodule\MyControl.ts" />
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\absolute.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\layouts\absolute.ts" />
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\dock.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\layouts\dock.ts" />
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\grid.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\layouts\grid.ts" />
|
||||||
@ -709,6 +713,12 @@
|
|||||||
<Content Include="apps\tests\xml-declaration\mymodulewithxml\MyControl.css" />
|
<Content Include="apps\tests\xml-declaration\mymodulewithxml\MyControl.css" />
|
||||||
<Content Include="apps\tests\xml-declaration\mymodule\MyControl.css" />
|
<Content Include="apps\tests\xml-declaration\mymodule\MyControl.css" />
|
||||||
<Content Include="apps\ui-tests-app\bindings\xmlbasics.xml" />
|
<Content Include="apps\ui-tests-app\bindings\xmlbasics.xml" />
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\mymodulewithxml\MyControl.css" />
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\mymodulewithxml\MyControl.xml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Content>
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\mymodule\MyControl.css" />
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\page.xml" />
|
||||||
<Content Include="apps\ui-tests-app\layouts\absolute.xml" />
|
<Content Include="apps\ui-tests-app\layouts\absolute.xml" />
|
||||||
<Content Include="apps\ui-tests-app\layouts\dock.xml" />
|
<Content Include="apps\ui-tests-app\layouts\dock.xml" />
|
||||||
<Content Include="apps\ui-tests-app\layouts\grid.xml" />
|
<Content Include="apps\ui-tests-app\layouts\grid.xml" />
|
||||||
@ -1591,6 +1601,12 @@
|
|||||||
<Content Include="apps\cuteness.unoptimized\package.json">
|
<Content Include="apps\cuteness.unoptimized\package.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\mymodule\package.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="apps\ui-tests-app\custom-components\mymodulewithxml\package.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<None Include="js-libs\esprima\LICENSE.BSD" />
|
<None Include="js-libs\esprima\LICENSE.BSD" />
|
||||||
<Content Include="source-control.md" />
|
<Content Include="source-control.md" />
|
||||||
<Content Include="ui\segmented-bar\package.json">
|
<Content Include="ui\segmented-bar\package.json">
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.MyStackLayout {
|
||||||
|
background-color: red;
|
||||||
|
}
|
24
apps/ui-tests-app/custom-components/mymodule/MyControl.ts
Normal file
24
apps/ui-tests-app/custom-components/mymodule/MyControl.ts
Normal 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";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
{ "name" : "MyControl",
|
||||||
|
"main" : "MyControl.js" }
|
@ -0,0 +1,3 @@
|
|||||||
|
.MySecondCustomStackLayout {
|
||||||
|
background-color: green;
|
||||||
|
}
|
@ -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!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
<StackLayout xmlns:customControls="xml-declaration/mymodule" cssClass="MySecondCustomStackLayout">
|
||||||
|
<Label id="Label1" text="mymodulewithxml" />
|
||||||
|
<Button text="Click!" tap="buttonTap2" />
|
||||||
|
</StackLayout>
|
@ -0,0 +1,2 @@
|
|||||||
|
{ "name" : "MyControl",
|
||||||
|
"main" : "MyControl.js" }
|
7
apps/ui-tests-app/custom-components/page.xml
Normal file
7
apps/ui-tests-app/custom-components/page.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Page xmlns:customControls="custom-components/mymodule"
|
||||||
|
xmlns:customControls2="custom-components/mymodulewithxml">
|
||||||
|
<StackLayout>
|
||||||
|
<customControls:MyControl />
|
||||||
|
<customControls2:MyControl />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
@ -10,7 +10,7 @@ import trace = require("trace");
|
|||||||
trace.enable();
|
trace.enable();
|
||||||
trace.setCategories(trace.categories.Test);
|
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
|
// basePath is auto-changed when building multiple apps
|
||||||
var basePath = "";
|
var basePath = "";
|
||||||
|
Reference in New Issue
Block a user