test: add e2e app for nested frame scenarios (#6626)

This commit is contained in:
Manol Donev
2018-11-28 16:59:17 +02:00
committed by GitHub
parent c8341819a3
commit f87ec4bc08
113 changed files with 3068 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { EventData, View } from "tns-core-modules/ui/core/view";
import { NavigatedData, Page } from "tns-core-modules/ui/page";
import { Item } from "../../shared/item";
export function onNavigatingTo(args: NavigatedData) {
const page = args.object as Page;
const item = args.context as Item;
page.bindingContext = item;
}
export function onBackButtonTap(args: EventData) {
const view = args.object as View;
view.page.frame.goBack();
}

View File

@@ -0,0 +1,12 @@
<Page class="page" navigatingTo="onNavigatingTo" xmlns="http://schemas.nativescript.org/tns.xsd">
<ActionBar class="action-bar">
<NavigationButton text="playerBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back"/>
<Label class="action-bar-title" text="{{ name }}"></Label>
</ActionBar>
<GridLayout>
<Label class="m-10 h3" verticalAlignment="top" text="{{ description }}"></Label>
</GridLayout>
</Page>

View File

@@ -0,0 +1,55 @@
import { View } from "tns-core-modules/ui/core/view";
import { ItemEventData } from "tns-core-modules/ui/list-view";
import { NavigatedData, Page } from "tns-core-modules/ui/page";
import { NavigationEntry } from "tns-core-modules/ui/frame";
import { ItemsViewModel } from "../shared/items-view-model";
import { Item } from "../shared/item";
export function onNavigatingTo(args: NavigatedData) {
const page = <Page>args.object;
page.bindingContext = new ItemsViewModel(new Array<Item>(
{ id: 1, name: "Player One (default transition)", description: "Goalkeeper", transition: "default" },
{ id: 2, name: "Player Two (default transition)", description: "Defender", transition: "default" },
{ id: 3, name: "Player One (no transition)", description: "Goalkeeper", transition: "none" },
{ id: 4, name: "Player Two (no transition)", description: "Defender", transition: "none" },
{ id: 5, name: "Player One (slide transition)", description: "Goalkeeper", transition: "slide" },
{ id: 6, name: "Player Two (slide transition)", description: "Defender", transition: "slide" },
{ id: 7, name: "Player One (flip transition)", description: "Goalkeeper", transition: "flip" },
{ id: 8, name: "Player Two (flip transition)", description: "Defender", transition: "flip" }
));
}
export function onItemTap(args: ItemEventData) {
const view = <View>args.view;
const page = <Page>view.page;
const tappedItem = <Item>view.bindingContext;
const entry: NavigationEntry = {
moduleName: "players/player-item-detail/player-item-detail-page",
context: tappedItem
};
switch (tappedItem.transition) {
case "none":
entry.animated = false;
break;
case "slide":
entry.transition = {
name: "slide",
duration: 380,
curve: "easeIn"
};
break;
case "flip":
entry.transition = {
name: "flip",
duration: 380,
curve: "easeIn"
};
break;
}
page.frame.navigate(entry);
}

View File

@@ -0,0 +1,14 @@
<Page class="page" navigatingTo="onNavigatingTo" xmlns="http://schemas.nativescript.org/tns.xsd">
<ActionBar class="action-bar">
<Label class="action-bar-title" text="Players"></Label>
</ActionBar>
<ListView items="{{ items }}" itemTap="onItemTap" class="list-group">
<ListView.itemTemplate>
<StackLayout orientation="horizontal" class="list-group-item">
<Label text="{{ name }}" textWrap="true"></Label>
</StackLayout>
</ListView.itemTemplate>
</ListView>
</Page>