mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Include test for groups and retrieving the content injectin
This commit is contained in:
31
ionic/components/item/test/groups/index.ts
Normal file
31
ionic/components/item/test/groups/index.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import {Host} from 'angular2/angular2';
|
||||
import {App} from 'ionic/ionic';
|
||||
import {Component, View, NgIf, NgFor} from 'angular2/angular2';
|
||||
import {Content, Icon, Item, ItemGroup, ItemGroupTitle, ItemSliding, List, ListHeader, NavController} from 'ionic/ionic';
|
||||
|
||||
|
||||
console.log('content', Content)
|
||||
|
||||
@Component({
|
||||
properties: ['data'],
|
||||
selector: 'component-list'
|
||||
})
|
||||
@View({
|
||||
directives: [ComponentList, Item, ItemGroup, ItemGroupTitle, List, NgIf, NgFor],
|
||||
templateUrl: 'list.html'
|
||||
})
|
||||
class ComponentList {
|
||||
constructor(@Host() content:Content) {
|
||||
console.log('Component List init', content);
|
||||
}
|
||||
}
|
||||
|
||||
@App({
|
||||
directives: [ComponentList, Item, ItemGroup, ItemGroupTitle, List, NgIf, NgFor],
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class E2EApp {
|
||||
constructor() {
|
||||
this.data = ['1'];
|
||||
}
|
||||
}
|
19
ionic/components/item/test/groups/list.html
Normal file
19
ionic/components/item/test/groups/list.html
Normal file
@ -0,0 +1,19 @@
|
||||
<ion-content class="outer-content">
|
||||
<ion-list>
|
||||
<ion-item-group class="outer-content" *ng-for="#timeSlot of data">
|
||||
<ion-item-group-title>
|
||||
{{timeSlot.time}}
|
||||
</ion-item-group-title>
|
||||
<ion-item *ng-for="#session of timeSlot.talks">
|
||||
<h3>{{session.name}}</h3>
|
||||
<p>
|
||||
<span>{{session.location}}</span>
|
||||
</p>
|
||||
<ion-item-options>
|
||||
<button primary (click)="openSession(session, $this)">Speaker Info</button>
|
||||
<button secondary (click)="addFavorite(timeSlot, session, $event)">Add to <br>Favorites</button>
|
||||
</ion-item-options>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
</ion-list>
|
||||
</ion-content>
|
7
ionic/components/item/test/groups/main.html
Normal file
7
ionic/components/item/test/groups/main.html
Normal file
@ -0,0 +1,7 @@
|
||||
<ion-content class="outer-content">
|
||||
<div *ng-if="data.length > 0">
|
||||
<component-list [data]="data"></component-list>
|
||||
</div>
|
||||
<div *ng-if="data.length == 0"><h4>No Items</h4></div>
|
||||
|
||||
</ion-content>
|
Reference in New Issue
Block a user