Skip to content

Commit 1827960

Browse files
author
vakrilov
committed
Code snippets
1 parent e128f82 commit 1827960

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

apps/tests/ui/action-bar/action-bar-tests-common.ts

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,79 @@
22
import LabelModule = require("ui/label");
33
import helper = require("../helper");
44
import builder = require("ui/builder");
5-
import actionBar = require("ui/action-bar");
65
import button = require("ui/button");
76
import PageModule = require("ui/page");
87

8+
// <snippet module="ui/action-bar" title="ActionBar">
9+
// # ActionBar
10+
// Using a ActionBar requires the action-bar module.
11+
// ``` JavaScript
12+
import actionBarModule = require("ui/action-bar");
13+
// ```
14+
//
15+
// ## Setting Title and Icon
16+
//```XML
17+
// <Page>
18+
// <Page.actionBar>
19+
// {%raw%}<ActionBar title="{{ title }}" android.icon="res://ic_test"/>{%endraw%}
20+
// </Page.actionBar>
21+
// ...
22+
// </Page>
23+
//```
24+
//The icon can only be set in Android platform. Following the design guides it is automatically hidden in Lollipop versions (API level >= 20). You explicitly control its visibility with the `android.iconVisibility' property.
25+
//
26+
//
27+
// ## Setting Custom Title View
28+
//```XML
29+
// <Page loaded="pageLoaded">
30+
// <Page.actionBar>
31+
// <ActionBar title="Title">
32+
// <ActionBar.titleView>
33+
// <StackLayout orientation="horizontal">
34+
// <Button text="1st" />
35+
// <Button text="2nd" />
36+
// <Button text="3rd" />
37+
// </StackLayout>
38+
// </ActionBar.titleView>
39+
// </ActionBar>
40+
// </Page.actionBar>
41+
// ...
42+
// </Page>
43+
//```
44+
//
45+
// ## Setting Action Items
46+
//```XML
47+
// <Page>
48+
// <Page.actionBar>
49+
// <ActionBar title="Title">
50+
// <ActionBar.actionItems>
51+
// <ActionItem text="left" ios.position="left"/>
52+
// <ActionItem text="right" ios.position="right"/>
53+
// <ActionItem text="pop" ios.position="right" android.position="popup"/>
54+
// </ActionBar.actionItems>
55+
// </ActionBar>
56+
// </Page.actionBar>
57+
// ...
58+
// </Page>
59+
//```
60+
//
61+
//The position option is platform specific. The available values are as follows:
62+
// * **Android** - `actionBar`, `actionBarIfRoom` and `popup`. The default is `actionBar`.
63+
// * **iOS** - `left` and `right`. The default is `left`.
64+
//
65+
// ## Setting Navigation Button
66+
//```XML
67+
// <Page>
68+
// <Page.actionBar>
69+
// <ActionBar title="Title">
70+
// <NavigationButton text="go back"/>
71+
// </ActionBar>
72+
// ...
73+
// </Page>
74+
//```
75+
//
76+
// </snippet>
77+
978
export function test_actionItem_inherit_bindingContext() {
1079
var page: PageModule.Page;
1180
var label: LabelModule.Label;
@@ -14,7 +83,7 @@ export function test_actionItem_inherit_bindingContext() {
1483
var pageFactory = function (): PageModule.Page {
1584
page = new PageModule.Page();
1685
page.bindingContext = context;
17-
var actionItem = new actionBar.ActionItem();
86+
var actionItem = new actionBarModule.ActionItem();
1887

1988
actionItem.bind({
2089
sourceProperty: "text",
@@ -110,7 +179,7 @@ export function test_Setting_ActionItems_doesnt_thrown() {
110179

111180
var pageFactory = function (): PageModule.Page {
112181
page = new PageModule.Page();
113-
var actionItem = new actionBar.ActionItem();
182+
var actionItem = new actionBarModule.ActionItem();
114183
actionItem.text = "Item";
115184
page.actionBar.actionItems.addItem(actionItem);
116185

0 commit comments

Comments
 (0)