我想知道如何确保ion-list
显示正确的内容。
ion-list
看起来像这样:
<ion-list [virtualScroll]="list" [approxItemHeight]="'132px'">
<ion-item *virtualItem="let item">
<span item-start>{{item.foo}}</span>
</ion-item>
</ion-list>
单元测试:
it('should display the correct content', () => {
comp.list = [ { foo: 'bar' } ];
fixture.detectChanges();
de = fixture.debugElement.query(By.css('ion-content'));
el = de.nativeElement;
console.log(el);
});
输出:
<ion-list class="list list-md virtual-loading" ng-reflect-virtual-scroll="[object Object],[object Object" ng-reflect-approx-item-height="132px">
<!---->
</ion-list>
如何触发业力在ion-item
中呈现ion-list
?
答案 0 :(得分:0)
您已经在测试中手动发出了更新事件:
const virtualScrollComponent = fixture.debugElement.query(By.directive(VirtualScrollComponent)).componentInstance;
virtualScrollComponent.update.emit(list);