| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,36 @@ | ||
| import { Frame, GridLayout, Label, TabView, View } from '@nativescript/core'; | ||
| import * as TKUnit from '../../tk-unit'; | ||
| import * as helper from '../../ui-helper'; | ||
|
|
||
| export * from './frame-tests-common'; | ||
|
|
||
| function assertHostedBelowHeader(hosted: View) { | ||
| const header = new Label(); | ||
| header.text = 'Header'; | ||
| const grid = new GridLayout(); | ||
| grid.rows = '50, *'; | ||
| GridLayout.setRow(hosted, 1); | ||
| grid.addChild(header); | ||
| grid.addChild(hosted); | ||
|
|
||
| helper.buildUIAndRunTest(grid, () => { | ||
| helper.waitUntilLayoutReady(hosted); | ||
|
|
||
| const headerFrame = (header.nativeViewProtected as UIView).frame; | ||
| const hostedFrame = (hosted.nativeViewProtected as UIView).frame; | ||
| const container = (grid.nativeViewProtected as UIView).bounds; | ||
|
|
||
| TKUnit.assertAreClose(hostedFrame.origin.y, headerFrame.origin.y + headerFrame.size.height, 0.5, 'top'); | ||
| TKUnit.assertAreClose(hostedFrame.origin.y + hostedFrame.size.height, container.size.height, 0.5, 'bottom'); | ||
| TKUnit.assertAreClose(hostedFrame.origin.x, 0, 0.5, 'left'); | ||
| TKUnit.assertAreClose(hostedFrame.size.width, container.size.width, 0.5, 'width'); | ||
| }); | ||
| } | ||
|
|
||
| export function test_frame_hosted_in_layout_fills_its_cell() { | ||
| assertHostedBelowHeader(new Frame()); | ||
| } | ||
|
|
||
| export function test_tab_view_hosted_in_layout_fills_its_cell() { | ||
| assertHostedBelowHeader(new TabView()); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Observable, EventData, Page, ActionItem } from '@nativescript/core'; | ||
|
|
||
| export function navigatingTo(args: EventData) { | ||
| const page = <Page>args.object; | ||
| page.bindingContext = new ActionItemsModel(); | ||
| } | ||
|
|
||
| export class ActionItemsModel extends Observable { | ||
| lastTapped = 'Tap an action item'; | ||
|
|
||
| onItemTap(args: EventData) { | ||
| this.set('lastTapped', `Tapped: ${(<ActionItem>args.object).text}`); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page"> | ||
| <Page.actionBar> | ||
| <ActionBar title="Action Items" class="action-bar"> | ||
| <ActionItem icon="sys://star" text="Favorite" ios.position="right" ios.visibilityPriority="high" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://square.and.arrow.up" text="Share" ios.position="right" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://bookmark" text="Bookmark" ios.position="right" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://flag" text="Flag" ios.position="right" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://folder" text="Move" ios.position="right" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://tag" text="Tag" ios.position="right" ios.visibilityPriority="low" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://archivebox" text="Archive" ios.position="right" ios.visibilityPriority="low" tap="{{ onItemTap }}" /> | ||
| <ActionItem icon="sys://printer" text="Print" ios.position="right" ios.visibilityPriority="low" ios.axisBehavior="horizontalOnly" tap="{{ onItemTap }}" /> | ||
| </ActionBar> | ||
| </Page.actionBar> | ||
|
|
||
| <StackLayout padding="20"> | ||
| <Label text="{{ lastTapped }}" textWrap="true" fontSize="17" /> | ||
| <Label text="Favorite: high priority. Tag, Archive and Print: low priority. Print: horizontal bars only." textWrap="true" marginTop="12" color="#888" /> | ||
| </StackLayout> | ||
| </Page> |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.