diff --git a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts index 60b1c78f8c..6a9de52f1f 100644 --- a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts +++ b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts @@ -180,17 +180,20 @@ describe('CommunityPageSubCollectionList Component', () => { comp.community = mockCommunity; }); - it('should display a list of collections', () => { - subCollList = collections; - fixture.detectChanges(); - const collList = fixture.debugElement.queryAll(By.css('li')); - expect(collList.length).toEqual(5); - expect(collList[0].nativeElement.textContent).toContain('Collection 1'); - expect(collList[1].nativeElement.textContent).toContain('Collection 2'); - expect(collList[2].nativeElement.textContent).toContain('Collection 3'); - expect(collList[3].nativeElement.textContent).toContain('Collection 4'); - expect(collList[4].nativeElement.textContent).toContain('Collection 5'); + it('should display a list of collections', () => { + waitForAsync(() => { + subCollList = collections; + fixture.detectChanges(); + + const collList = fixture.debugElement.queryAll(By.css('li')); + expect(collList.length).toEqual(5); + expect(collList[0].nativeElement.textContent).toContain('Collection 1'); + expect(collList[1].nativeElement.textContent).toContain('Collection 2'); + expect(collList[2].nativeElement.textContent).toContain('Collection 3'); + expect(collList[3].nativeElement.textContent).toContain('Collection 4'); + expect(collList[4].nativeElement.textContent).toContain('Collection 5'); + }); }); it('should not display the header when list of collections is empty', () => { diff --git a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts index c3db1bd17d..c75c5b6f6c 100644 --- a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts +++ b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts @@ -181,17 +181,20 @@ describe('CommunityPageSubCommunityListComponent Component', () => { }); - it('should display a list of sub-communities', () => { - subCommList = subcommunities; - fixture.detectChanges(); - const subComList = fixture.debugElement.queryAll(By.css('li')); - expect(subComList.length).toEqual(5); - expect(subComList[0].nativeElement.textContent).toContain('SubCommunity 1'); - expect(subComList[1].nativeElement.textContent).toContain('SubCommunity 2'); - expect(subComList[2].nativeElement.textContent).toContain('SubCommunity 3'); - expect(subComList[3].nativeElement.textContent).toContain('SubCommunity 4'); - expect(subComList[4].nativeElement.textContent).toContain('SubCommunity 5'); + it('should display a list of sub-communities', () => { + waitForAsync(() => { + subCommList = subcommunities; + fixture.detectChanges(); + + const subComList = fixture.debugElement.queryAll(By.css('li')); + expect(subComList.length).toEqual(5); + expect(subComList[0].nativeElement.textContent).toContain('SubCommunity 1'); + expect(subComList[1].nativeElement.textContent).toContain('SubCommunity 2'); + expect(subComList[2].nativeElement.textContent).toContain('SubCommunity 3'); + expect(subComList[3].nativeElement.textContent).toContain('SubCommunity 4'); + expect(subComList[4].nativeElement.textContent).toContain('SubCommunity 5'); + }); }); it('should not display the header when list of sub-communities is empty', () => { diff --git a/src/app/home-page/top-level-community-list/top-level-community-list.component.spec.ts b/src/app/home-page/top-level-community-list/top-level-community-list.component.spec.ts index fcddccd89e..5dbf1ff8a2 100644 --- a/src/app/home-page/top-level-community-list/top-level-community-list.component.spec.ts +++ b/src/app/home-page/top-level-community-list/top-level-community-list.component.spec.ts @@ -175,14 +175,18 @@ describe('TopLevelCommunityList Component', () => { }); - it('should display a list of top-communities', () => { - const subComList = fixture.debugElement.queryAll(By.css('li')); - expect(subComList.length).toEqual(5); - expect(subComList[0].nativeElement.textContent).toContain('TopCommunity 1'); - expect(subComList[1].nativeElement.textContent).toContain('TopCommunity 2'); - expect(subComList[2].nativeElement.textContent).toContain('TopCommunity 3'); - expect(subComList[3].nativeElement.textContent).toContain('TopCommunity 4'); - expect(subComList[4].nativeElement.textContent).toContain('TopCommunity 5'); + it('should display a list of top-communities', () => { + waitForAsync(() => { + const subComList = fixture.debugElement.queryAll(By.css('li')); + + expect(subComList.length).toEqual(5); + expect(subComList[0].nativeElement.textContent).toContain('TopCommunity 1'); + expect(subComList[1].nativeElement.textContent).toContain('TopCommunity 2'); + expect(subComList[2].nativeElement.textContent).toContain('TopCommunity 3'); + expect(subComList[3].nativeElement.textContent).toContain('TopCommunity 4'); + expect(subComList[4].nativeElement.textContent).toContain('TopCommunity 5'); + }); }); + }); diff --git a/src/app/shared/browse-by/browse-by.component.spec.ts b/src/app/shared/browse-by/browse-by.component.spec.ts index 2a679035f6..43a3910216 100644 --- a/src/app/shared/browse-by/browse-by.component.spec.ts +++ b/src/app/shared/browse-by/browse-by.component.spec.ts @@ -198,11 +198,13 @@ describe('BrowseByComponent', () => { }); it('should use the base component to render browse entries', () => { - const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent)); - expect(componentLoaders.length).toEqual(browseEntries.length); - componentLoaders.forEach((componentLoader) => { - const browseEntry = componentLoader.query(By.css('ds-browse-entry-list-element')); - expect(browseEntry.componentInstance).toBeInstanceOf(BrowseEntryListElementComponent); + waitForAsync(() => { + const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent)); + expect(componentLoaders.length).toEqual(browseEntries.length); + componentLoaders.forEach((componentLoader) => { + const browseEntry = componentLoader.query(By.css('ds-browse-entry-list-element')); + expect(browseEntry.componentInstance).toBeInstanceOf(BrowseEntryListElementComponent); + }); }); }); }); @@ -215,11 +217,13 @@ describe('BrowseByComponent', () => { }); it('should use the themed component to render browse entries', () => { - const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent)); - expect(componentLoaders.length).toEqual(browseEntries.length); - componentLoaders.forEach((componentLoader) => { - const browseEntry = componentLoader.query(By.css('ds-browse-entry-list-element')); - expect(browseEntry.componentInstance).toBeInstanceOf(MockThemedBrowseEntryListElementComponent); + waitForAsync(() => { + const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent)); + expect(componentLoaders.length).toEqual(browseEntries.length); + componentLoaders.forEach((componentLoader) => { + const browseEntry = componentLoader.query(By.css('ds-browse-entry-list-element')); + expect(browseEntry.componentInstance).toBeInstanceOf(MockThemedBrowseEntryListElementComponent); + }); }); }); });