Skip to content

Commit

Permalink
Merge pull request #3610 from IgniteUI/gedinakova/fix-3602-master
Browse files Browse the repository at this point in the history
Allow for showing the loading template even when list items are present. #3608
  • Loading branch information
rkaraivanov authored Jan 15, 2019
2 parents 0ea027f + 98e6065 commit 52fd9d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion projects/igniteui-angular/src/lib/list/list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</article>
</ng-template>

<ng-container *ngIf="!children || children.length === 0">
<ng-container *ngIf="!children || children.length === 0 || isLoading">
<ng-container *ngTemplateOutlet="template; context: context">
</ng-container>
</ng-container>
19 changes: 19 additions & 0 deletions projects/igniteui-angular/src/lib/list/list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,25 @@ describe('List', () => {
expect(noItemsParagraphEl.nativeElement.textContent.trim()).toBe(listLoadingItemsMessage);
});

it('Should show loading template when isLoading=\'true\' even when there are children.', () => {
const fixture = TestBed.createComponent(ListWithHeaderComponent);
const list = fixture.componentInstance.list;
list.isLoading = true;
const listLoadingItemsMessage = 'Loading data from the server...';

fixture.detectChanges();

verifyItemsCount(list, 3);

const noItemsParagraphEl = fixture.debugElement.query(By.css('p'));
expect(noItemsParagraphEl.nativeElement.textContent.trim()).toBe(listLoadingItemsMessage);

list.isLoading = false;
fixture.detectChanges();

expect(fixture.debugElement.query(By.css('p'))).toBeFalsy();
});

it('Should have custom loading template.', () => {
const fixture = TestBed.createComponent(ListCustomLoadingComponent);
const list = fixture.componentInstance.list;
Expand Down

0 comments on commit 52fd9d9

Please sign in to comment.