55959: Add additional test when no subcommunities

When the subcommunity list is empty, the subcommunity section should be hidden.
This commit is contained in:
Yana De Pauw
2018-10-26 10:55:27 +02:00
parent f4482c710c
commit 44c227ffff

View File

@@ -39,6 +39,17 @@ describe('SubCommunityList Component', () => {
})
];
const emptySubCommunitiesCommunity = Object.assign(new Community(), {
metadata: [
{
key: 'dc.title',
language: 'en_US',
value: 'Test title'
}],
subcommunities: Observable.of(new RemoteData(true, true, true,
undefined, new PaginatedList(new PageInfo(), [])))
});
const mockCommunity = Object.assign(new Community(), {
metadata: [
{
@@ -75,4 +86,12 @@ describe('SubCommunityList Component', () => {
expect(subComList[0].nativeElement.textContent).toContain('SubCommunity 1');
expect(subComList[1].nativeElement.textContent).toContain('SubCommunity 2');
});
it('should not display the header when subCommunities are empty', () => {
comp.community = emptySubCommunitiesCommunity;
fixture.detectChanges();
const subComHead = fixture.debugElement.queryAll(By.css('h2'));
expect(subComHead.length).toEqual(0);
});
});