From 85e15e6af048e28109f3adcb8c802dd51c9ee757 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 8 Jul 2015 15:41:02 +0300 Subject: [PATCH] ui-test added --- CrossPlatformModules.csproj | 16 +++++++++++++ .../custom-components/mymodule/MyControl.css | 3 +++ .../custom-components/mymodule/MyControl.ts | 24 +++++++++++++++++++ .../custom-components/mymodule/package.json | 2 ++ .../mymodulewithxml/MyControl.css | 3 +++ .../mymodulewithxml/MyControl.ts | 16 +++++++++++++ .../mymodulewithxml/MyControl.xml | 4 ++++ .../mymodulewithxml/package.json | 2 ++ apps/ui-tests-app/custom-components/page.xml | 7 ++++++ apps/ui-tests-app/mainPage.ts | 2 +- 10 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 apps/ui-tests-app/custom-components/mymodule/MyControl.css create mode 100644 apps/ui-tests-app/custom-components/mymodule/MyControl.ts create mode 100644 apps/ui-tests-app/custom-components/mymodule/package.json create mode 100644 apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.css create mode 100644 apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.ts create mode 100644 apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.xml create mode 100644 apps/ui-tests-app/custom-components/mymodulewithxml/package.json create mode 100644 apps/ui-tests-app/custom-components/page.xml diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index 5378cc00e..3daeec9e5 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -212,6 +212,10 @@ xmlbasics.xml + + MyControl.xml + + @@ -709,6 +713,12 @@ + + + Designer + + + @@ -1591,6 +1601,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + diff --git a/apps/ui-tests-app/custom-components/mymodule/MyControl.css b/apps/ui-tests-app/custom-components/mymodule/MyControl.css new file mode 100644 index 000000000..d701672c7 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodule/MyControl.css @@ -0,0 +1,3 @@ +.MyStackLayout { + background-color: red; +} diff --git a/apps/ui-tests-app/custom-components/mymodule/MyControl.ts b/apps/ui-tests-app/custom-components/mymodule/MyControl.ts new file mode 100644 index 000000000..aca0396d3 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodule/MyControl.ts @@ -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"; + } +} \ No newline at end of file diff --git a/apps/ui-tests-app/custom-components/mymodule/package.json b/apps/ui-tests-app/custom-components/mymodule/package.json new file mode 100644 index 000000000..55267b5f2 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodule/package.json @@ -0,0 +1,2 @@ +{ "name" : "MyControl", + "main" : "MyControl.js" } \ No newline at end of file diff --git a/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.css b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.css new file mode 100644 index 000000000..dd3ccf653 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.css @@ -0,0 +1,3 @@ +.MySecondCustomStackLayout { + background-color: green; +} diff --git a/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.ts b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.ts new file mode 100644 index 000000000..532f0f6c5 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.ts @@ -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 = (args.object).parent; + if (parent) { + var lbl = parent.getViewById("Label1"); + if (lbl) { + lbl.text = "You clicked " + count + " times!"; + } + } +} \ No newline at end of file diff --git a/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.xml b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.xml new file mode 100644 index 000000000..4fe8e30f7 --- /dev/null +++ b/apps/ui-tests-app/custom-components/mymodulewithxml/MyControl.xml @@ -0,0 +1,4 @@ + +