mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[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:

committed by
Peter Wolfersberger

parent
8805ac33fc
commit
133f35cb42
@@ -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', () => {
|
||||
|
@@ -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', () => {
|
||||
|
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user