From ea1ebd2c9497110f3b245db8070c82d170ff6550 Mon Sep 17 00:00:00 2001 From: Peter Staev Date: Mon, 15 Feb 2016 12:18:32 +0200 Subject: [PATCH] tests for #1488 --- CrossPlatformModules.csproj | 6 +++ .../ui/action-bar/action-bar-tests-common.ts | 52 +++++++++++++++++++ apps/ui-tests-app/action-bar/action-view.ts | 5 ++ apps/ui-tests-app/action-bar/action-view.xml | 19 +++++++ apps/ui-tests-app/mainPage.ts | 1 + tsconfig.json | 1 + 6 files changed, 84 insertions(+) create mode 100644 apps/ui-tests-app/action-bar/action-view.ts create mode 100644 apps/ui-tests-app/action-bar/action-view.xml diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index 760e382c0..0ffa03671 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -222,6 +222,9 @@ Designer + + Designer + Designer @@ -255,6 +258,9 @@ Designer + + action-view.xml + Designer diff --git a/apps/tests/ui/action-bar/action-bar-tests-common.ts b/apps/tests/ui/action-bar/action-bar-tests-common.ts index 00bb42ba8..2c4b888e1 100644 --- a/apps/tests/ui/action-bar/action-bar-tests-common.ts +++ b/apps/tests/ui/action-bar/action-bar-tests-common.ts @@ -118,6 +118,27 @@ import actionBarModule = require("ui/action-bar"); //The value should be a string such as 'ic_menu_search' if you want to display the built-in Android Menu Search icon for example. //For a full list of Android drawable names, please visit http://androiddrawables.com // +// ## Displaying Custom View in Action Items +//```XML +// +// +// +// +// +// +// +// +// +// +// +// +// +// ... +// +//``` +// // ## Setting Navigation Button //```XML // @@ -197,6 +218,37 @@ export function test_actionItem_page_property_inXML() { TKUnit.assertEqual(actionItem.page, p, "actionItem.page"); }; +export function test_actionItem_actionView_inXML() { + var p = builder.parse( + " " + + " "); + + var label = p.actionBar.actionItems.getItemAt(0).actionView; + TKUnit.assert(label instanceof LabelModule.Label, "ActionItem.actionView not loaded correctly"); +}; + +export function test_actionItem_actionView_inherit_bindingContext_inXML() { + var p = builder.parse( + " " + + " "); + p.bindingContext = { myProp: "success" }; + + var label = p.actionBar.actionItems.getItemAt(0).actionView; + TKUnit.assert(label instanceof LabelModule.Label, "ActionItem.actionView not loaded correctly"); + TKUnit.assertEqual(label.text, "success", "ActionItem.actionView"); +}; + +export function test_ActionBar_is_not_empty_when_actionItem_actionView_is_set() { + var p = builder.parse( + " " + + " "); + + TKUnit.assertFalse(p.actionBar._isEmpty(), "ActionItem.actionView is set but ActionBar reports empty"); +}; + export function test_navigationButton_inherit_bindingContext_inXML() { var p = builder.parse( " " + diff --git a/apps/ui-tests-app/action-bar/action-view.ts b/apps/ui-tests-app/action-bar/action-view.ts new file mode 100644 index 000000000..ac77dc39d --- /dev/null +++ b/apps/ui-tests-app/action-bar/action-view.ts @@ -0,0 +1,5 @@ +import frame = require("ui/frame"); + +export function navigate(args) { + frame.topmost().navigate("action-bar/clean"); +} \ No newline at end of file diff --git a/apps/ui-tests-app/action-bar/action-view.xml b/apps/ui-tests-app/action-bar/action-view.xml new file mode 100644 index 000000000..9e8d414c9 --- /dev/null +++ b/apps/ui-tests-app/action-bar/action-view.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +