From ff2e8e662579874c5d9f79627093b7b327942780 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Tue, 14 Jul 2015 11:19:49 +0300 Subject: [PATCH] tests --- CrossPlatformModules.csproj | 37 +++-- apps/tests/testRunner.ts | 1 + .../ui/action-bar/action-bar-tests-common.ts | 136 ++++++++++++++++++ .../ui/action-bar/action-bar-tests.android.ts | 4 + .../ui/action-bar/action-bar-tests.ios.ts | 84 +++++++++++ apps/tests/ui/helper.ts | 14 +- apps/tests/ui/page/page-tests-common.ts | 78 ---------- apps/tests/ui/page/page-tests.ios.ts | 76 ---------- apps/tests/ui/view/view-tests-common.ts | 3 +- apps/tests/ui/view/view-tests.android.ts | 35 +++-- ui/action-bar/action-bar-common.ts | 18 ++- ui/action-bar/action-bar.d.ts | 5 +- ui/page/page-common.ts | 13 +- 13 files changed, 312 insertions(+), 192 deletions(-) create mode 100644 apps/tests/ui/action-bar/action-bar-tests-common.ts create mode 100644 apps/tests/ui/action-bar/action-bar-tests.android.ts create mode 100644 apps/tests/ui/action-bar/action-bar-tests.ios.ts diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index a1551a6ca..7d201e7d8 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -61,10 +61,21 @@ - - - - + + action-items-text.xml + + + center-view-stack.xml + + + center-view-segmented.xml + + + center-view.xml + + + data-binding.xml + details-page.xml @@ -83,10 +94,15 @@ main-page.xml - - - - + + navigation-button.xml + + + action-items-icon.xml + + + page-title-icon.xml + list-picker.xml @@ -172,6 +188,9 @@ + + + bindingContext_testPage.xml @@ -1728,7 +1747,7 @@ False - + \ No newline at end of file diff --git a/apps/tests/testRunner.ts b/apps/tests/testRunner.ts index b40bec212..a39c70c74 100644 --- a/apps/tests/testRunner.ts +++ b/apps/tests/testRunner.ts @@ -23,6 +23,7 @@ function isRunningOnEmulator(): boolean { } export var allTests = {}; +allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests"); allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests"); allTests["APPLICATION"] = require("./application-tests"); allTests["DOCKLAYOUT"] = require("./layouts/dock-layout-tests"); diff --git a/apps/tests/ui/action-bar/action-bar-tests-common.ts b/apps/tests/ui/action-bar/action-bar-tests-common.ts new file mode 100644 index 000000000..953ed5522 --- /dev/null +++ b/apps/tests/ui/action-bar/action-bar-tests-common.ts @@ -0,0 +1,136 @@ +import TKUnit = require("../../TKUnit"); +import LabelModule = require("ui/label"); +import helper = require("../helper"); +import builder = require("ui/builder"); +import actionBar = require("ui/action-bar"); +import button = require("ui/button"); +import PageModule = require("ui/page"); + +export function test_actionItem_inherit_bindingContext() { + var page: PageModule.Page; + var label: LabelModule.Label; + var context = { text: "item" }; + + var pageFactory = function (): PageModule.Page { + page = new PageModule.Page(); + page.bindingContext = context; + var actionItem = new actionBar.ActionItem(); + + actionItem.bind({ + sourceProperty: "text", + targetProperty: "text" + }); + + page.actionBar.actionItems.addItem(actionItem); + + label = new LabelModule.Label(); + label.text = "Text"; + page.content = label; + return page; + }; + + helper.navigate(pageFactory); + + try { + TKUnit.assertEqual(page.actionBar.actionItems.getItemAt(0).text, "item", "actionItem.text"); + } + finally { + helper.goBack(); + } +} + +export function test_actionBar_inherit_bindingContext_inXML() { + var p = builder.parse( + " "); + p.bindingContext = { myProp: "success" }; + + TKUnit.assertEqual(p.actionBar.title, "success", "actionBar.title"); +}; + +export function test_actionItem_inherit_bindingContext_inXML() { + var p = builder.parse( + " " + + "" + + " "); + p.bindingContext = { myProp: "success" }; + + var actionItem = p.actionBar.actionItems.getItemAt(0); + + TKUnit.assertEqual(actionItem.text, "success", "actionItem.text"); +}; + +export function test_navigationButton_inherit_bindingContext_inXML() { + var p = builder.parse( + " " + + "" + + " "); + p.bindingContext = { myProp: "success" }; + + var navButton = p.actionBar.navigationButton; + TKUnit.assertEqual(navButton.text, "success", "actionItem.text"); +}; + +export function test_centerView_inherit_bindingContext_inXML() { + var p = builder.parse( + " " + + "