mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
test(item): fix sliding test so it uses ViewChild
This commit is contained in:
@ -1,21 +1,24 @@
|
|||||||
import {App, Page, IonicApp, Alert, NavController} from '../../../../../src';
|
import {ViewChild} from '@angular/core';
|
||||||
|
import {App, Page, IonicApp, Alert, NavController, List, ItemSliding} from '../../../../../src';
|
||||||
|
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'main.html'
|
templateUrl: 'main.html'
|
||||||
})
|
})
|
||||||
class E2EPage {
|
class E2EPage {
|
||||||
|
@ViewChild('myList', {read: List}) list: List;
|
||||||
|
|
||||||
|
items = [];
|
||||||
|
shouldShow: boolean = true;
|
||||||
|
|
||||||
constructor(private app: IonicApp, private nav: NavController) {
|
constructor(private app: IonicApp, private nav: NavController) {
|
||||||
this.items = [];
|
|
||||||
for (let x = 0; x < 20; x++) {
|
for (let x = 0; x < 20; x++) {
|
||||||
this.items.push(x);
|
this.items.push(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shouldShow = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeOpened() {
|
closeOpened() {
|
||||||
this.app.getComponent('myList').closeSlidingItems();
|
this.list.closeSlidingItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
didClick(item) {
|
didClick(item) {
|
||||||
@ -68,7 +71,9 @@ class E2EPage {
|
|||||||
template: '<ion-nav [root]="root"></ion-nav>'
|
template: '<ion-nav [root]="root"></ion-nav>'
|
||||||
})
|
})
|
||||||
class E2EApp {
|
class E2EApp {
|
||||||
|
root = E2EPage;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.root = E2EPage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<ion-list id="myList">
|
<ion-list #myList>
|
||||||
|
|
||||||
<ion-item-sliding #item>
|
<ion-item-sliding #item>
|
||||||
<button ion-item text-wrap (click)="didClick(item)">
|
<button ion-item text-wrap (click)="didClick(item)">
|
||||||
|
Reference in New Issue
Block a user