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( + " " + + "