[TLC-372] Wait for async before testing obj lists in some tests

Browse by, obj list and other related components were
themed in this PR and added to lazy theme module.
This commit is contained in:
Kim Shepherd
2022-09-21 11:44:20 +12:00
committed by Peter Wolfersberger
parent 8805ac33fc
commit 133f35cb42
4 changed files with 52 additions and 38 deletions

View File

@@ -180,7 +180,9 @@ describe('CommunityPageSubCollectionList Component', () => {
comp.community = mockCommunity;
});
it('should display a list of collections', () => {
waitForAsync(() => {
subCollList = collections;
fixture.detectChanges();
@@ -192,6 +194,7 @@ describe('CommunityPageSubCollectionList Component', () => {
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', () => {
subCollList = [];

View File

@@ -181,7 +181,9 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
});
it('should display a list of sub-communities', () => {
waitForAsync(() => {
subCommList = subcommunities;
fixture.detectChanges();
@@ -193,6 +195,7 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
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', () => {
subCommList = [];

View File

@@ -175,7 +175,9 @@ describe('TopLevelCommunityList Component', () => {
});
it('should display a list of top-communities', () => {
waitForAsync(() => {
const subComList = fixture.debugElement.queryAll(By.css('li'));
expect(subComList.length).toEqual(5);
@@ -185,4 +187,6 @@ describe('TopLevelCommunityList Component', () => {
expect(subComList[3].nativeElement.textContent).toContain('TopCommunity 4');
expect(subComList[4].nativeElement.textContent).toContain('TopCommunity 5');
});
});
});

View File

@@ -198,6 +198,7 @@ describe('BrowseByComponent', () => {
});
it('should use the base component to render browse entries', () => {
waitForAsync(() => {
const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent));
expect(componentLoaders.length).toEqual(browseEntries.length);
componentLoaders.forEach((componentLoader) => {
@@ -206,6 +207,7 @@ describe('BrowseByComponent', () => {
});
});
});
});
describe('when theme is custom', () => {
beforeEach(() => {
@@ -215,6 +217,7 @@ describe('BrowseByComponent', () => {
});
it('should use the themed component to render browse entries', () => {
waitForAsync(() => {
const componentLoaders = fixture.debugElement.queryAll(By.directive(ListableObjectComponentLoaderComponent));
expect(componentLoaders.length).toEqual(browseEntries.length);
componentLoaders.forEach((componentLoader) => {
@@ -224,6 +227,7 @@ describe('BrowseByComponent', () => {
});
});
});
});
describe('reset filters button', () => {
it('should not be present when no startsWith or value is present ', () => {