|
1 | 1 | import { BidiModule, Dir } from '@angular/cdk/bidi';
|
2 | 2 | import { Component, DebugElement, TemplateRef, ViewChild } from '@angular/core';
|
3 |
| -import { ComponentFixture, TestBed } from '@angular/core/testing'; |
| 3 | +import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; |
4 | 4 | import { By } from '@angular/platform-browser';
|
| 5 | +import { Observable, timer } from 'rxjs'; |
| 6 | +import { map } from 'rxjs/operators'; |
5 | 7 |
|
6 | 8 | import { ComponentBed, createComponentBed } from 'ng-zorro-antd/core/testing/component-bed';
|
7 | 9 | import { NzIconTestModule } from 'ng-zorro-antd/icon/testing';
|
@@ -163,6 +165,11 @@ describe('list', () => {
|
163 | 165 | expect(dl.query(By.css('.ant-list-item-main')) != null).toBe(true);
|
164 | 166 | expect(dl.query(By.css('.ant-list-item-extra')) != null).toBe(true);
|
165 | 167 | });
|
| 168 | + it('should display the asynchronous action', fakeAsync(() => { |
| 169 | + tick(2000); |
| 170 | + fixture.detectChanges(); |
| 171 | + expect(dl.query(By.css('.ant-list-item-action')) != null).toBe(true); |
| 172 | + })); |
166 | 173 | });
|
167 | 174 |
|
168 | 175 | describe('item', () => {
|
@@ -259,6 +266,9 @@ describe('list RTL', () => {
|
259 | 266 | nzAvatar="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
|
260 | 267 | nzDescription="Ant Design, a design language for background applications, is refined by Ant UED Team"
|
261 | 268 | ></nz-list-item-meta>
|
| 269 | + <ul nz-list-item-actions> |
| 270 | + <nz-list-item-action *ngFor="let action of actions$ | async">{{ action }}</nz-list-item-action> |
| 271 | + </ul> |
262 | 272 | </nz-list-item>
|
263 | 273 | </ng-template>
|
264 | 274 | <ng-template #loadMore>
|
@@ -290,6 +300,7 @@ class TestListComponent {
|
290 | 300 | ];
|
291 | 301 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
292 | 302 | nzGrid: any = { gutter: 16, span: 12 };
|
| 303 | + actions$: Observable<string[]> = timer(500).pipe(map(() => ['Edit', 'Delete'])); |
293 | 304 | }
|
294 | 305 |
|
295 | 306 | @Component({
|
|
0 commit comments