mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
tests for #1488
This commit is contained in:
@@ -222,6 +222,9 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="apps\tests\pages\tab-view.xml" />
|
<Content Include="apps\tests\pages\tab-view.xml" />
|
||||||
|
<Content Include="apps\ui-tests-app\action-bar\action-view.xml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Content>
|
||||||
<Content Include="apps\ui-tests-app\action-bar\system-icons.xml">
|
<Content Include="apps\ui-tests-app\action-bar\system-icons.xml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -255,6 +258,9 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\animations\background.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\animations\background.ts" />
|
||||||
|
<TypeScriptCompile Include="apps\ui-tests-app\action-bar\action-view.ts">
|
||||||
|
<DependentUpon>action-view.xml</DependentUpon>
|
||||||
|
</TypeScriptCompile>
|
||||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\touch-event.ts" />
|
<TypeScriptCompile Include="apps\ui-tests-app\pages\touch-event.ts" />
|
||||||
<Content Include="apps\ui-tests-app\pages\touch-event.xml">
|
<Content Include="apps\ui-tests-app\pages\touch-event.xml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -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.
|
//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
|
//For a full list of Android drawable names, please visit http://androiddrawables.com
|
||||||
//
|
//
|
||||||
|
// ## Displaying Custom View in Action Items
|
||||||
|
//```XML
|
||||||
|
// <Page>
|
||||||
|
// <Page.actionBar>
|
||||||
|
// <ActionBar>
|
||||||
|
// <ActionBar.actionItems>
|
||||||
|
// <ActionItem>
|
||||||
|
// <ActionItem.actionView>
|
||||||
|
// <StackLayout orientation="horizontal">
|
||||||
|
// <Label text="Green" color="green"/>
|
||||||
|
// <Label text="Red" color="red"/>
|
||||||
|
// </StackLayout>
|
||||||
|
// </ActionItem.actionView>
|
||||||
|
// </ActionItem>
|
||||||
|
// </ActionBar.actionItems>
|
||||||
|
// </ActionBar>
|
||||||
|
// </Page.actionBar>
|
||||||
|
// ...
|
||||||
|
// </Page>
|
||||||
|
//```
|
||||||
|
//
|
||||||
// ## Setting Navigation Button
|
// ## Setting Navigation Button
|
||||||
//```XML
|
//```XML
|
||||||
// <Page>
|
// <Page>
|
||||||
@@ -197,6 +218,37 @@ export function test_actionItem_page_property_inXML() {
|
|||||||
TKUnit.assertEqual(actionItem.page, p, "actionItem.page");
|
TKUnit.assertEqual(actionItem.page, p, "actionItem.page");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function test_actionItem_actionView_inXML() {
|
||||||
|
var p = <PageModule.Page>builder.parse(
|
||||||
|
"<Page> <Page.actionBar> <ActionBar> <ActionItem> <ActionItem.actionView>" +
|
||||||
|
"<Label/>" +
|
||||||
|
"</ActionItem.actionView> </ActionItem> </ActionBar> </Page.actionBar> </Page>");
|
||||||
|
|
||||||
|
var label = <LabelModule.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 = <PageModule.Page>builder.parse(
|
||||||
|
"<Page> <Page.actionBar> <ActionBar> <ActionItem> <ActionItem.actionView>" +
|
||||||
|
"<Label text=\"{{ myProp }} \" />" +
|
||||||
|
"</ActionItem.actionView> </ActionItem> </ActionBar> </Page.actionBar> </Page>");
|
||||||
|
p.bindingContext = { myProp: "success" };
|
||||||
|
|
||||||
|
var label = <LabelModule.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 = <PageModule.Page>builder.parse(
|
||||||
|
"<Page> <Page.actionBar> <ActionBar> <ActionItem> <ActionItem.actionView>" +
|
||||||
|
"<Label text=\"test\" />" +
|
||||||
|
"</ActionItem.actionView> </ActionItem> </ActionBar> </Page.actionBar> </Page>");
|
||||||
|
|
||||||
|
TKUnit.assertFalse(p.actionBar._isEmpty(), "ActionItem.actionView is set but ActionBar reports empty");
|
||||||
|
};
|
||||||
|
|
||||||
export function test_navigationButton_inherit_bindingContext_inXML() {
|
export function test_navigationButton_inherit_bindingContext_inXML() {
|
||||||
var p = <PageModule.Page>builder.parse(
|
var p = <PageModule.Page>builder.parse(
|
||||||
"<Page> <Page.actionBar> <ActionBar>" +
|
"<Page> <Page.actionBar> <ActionBar>" +
|
||||||
|
|||||||
5
apps/ui-tests-app/action-bar/action-view.ts
Normal file
5
apps/ui-tests-app/action-bar/action-view.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import frame = require("ui/frame");
|
||||||
|
|
||||||
|
export function navigate(args) {
|
||||||
|
frame.topmost().navigate("action-bar/clean");
|
||||||
|
}
|
||||||
19
apps/ui-tests-app/action-bar/action-view.xml
Normal file
19
apps/ui-tests-app/action-bar/action-view.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<Page>
|
||||||
|
<Page.actionBar>
|
||||||
|
<ActionBar>
|
||||||
|
<ActionBar.actionItems>
|
||||||
|
<ActionItem>
|
||||||
|
<ActionItem.actionView>
|
||||||
|
<StackLayout orientation="horizontal">
|
||||||
|
<Label text="Green" color="green"/>
|
||||||
|
<Label text="Red" color="red"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ActionItem.actionView>
|
||||||
|
</ActionItem>
|
||||||
|
</ActionBar.actionItems>
|
||||||
|
</ActionBar>
|
||||||
|
</Page.actionBar>
|
||||||
|
<StackLayout>
|
||||||
|
<Button text="go to cleared page" tap="navigate"/>
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
||||||
@@ -36,6 +36,7 @@ examples.set("actColor", "action-bar/color");
|
|||||||
examples.set("actBG", "action-bar/background");
|
examples.set("actBG", "action-bar/background");
|
||||||
examples.set("actStyle", "action-bar/all");
|
examples.set("actStyle", "action-bar/all");
|
||||||
examples.set("actIcons", "action-bar/system-icons");
|
examples.set("actIcons", "action-bar/system-icons");
|
||||||
|
examples.set("actView", "action-bar/action-view");
|
||||||
|
|
||||||
examples.set("basics", "bindings/basics");
|
examples.set("basics", "bindings/basics");
|
||||||
examples.set("xmlbasics", "bindings/xmlbasics");
|
examples.set("xmlbasics", "bindings/xmlbasics");
|
||||||
|
|||||||
@@ -343,6 +343,7 @@
|
|||||||
"apps/ui-tests-app/action-bar/clean.ts",
|
"apps/ui-tests-app/action-bar/clean.ts",
|
||||||
"apps/ui-tests-app/action-bar/color.ts",
|
"apps/ui-tests-app/action-bar/color.ts",
|
||||||
"apps/ui-tests-app/action-bar/system-icons.ts",
|
"apps/ui-tests-app/action-bar/system-icons.ts",
|
||||||
|
"apps/ui-tests-app/action-bar/action-view.ts",
|
||||||
"apps/ui-tests-app/animations/background.ts",
|
"apps/ui-tests-app/animations/background.ts",
|
||||||
"apps/ui-tests-app/app.ts",
|
"apps/ui-tests-app/app.ts",
|
||||||
"apps/ui-tests-app/bindings/basics.ts",
|
"apps/ui-tests-app/bindings/basics.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user