mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Fix TopLevelCommunityListComponent, CommunityPageSubCollectionListComponent, CommunityPageSubCommunityListComponent no expectation tests
Because their child components use a themed component the changes need to be detected twice, this is a side effect from the component being created dynamically
This commit is contained in:
@@ -30,7 +30,7 @@ import { ConfigurationProperty } from '../../core/shared/configuration-property.
|
|||||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||||
import { SearchConfigurationServiceStub } from '../../shared/testing/search-configuration-service.stub';
|
import { SearchConfigurationServiceStub } from '../../shared/testing/search-configuration-service.stub';
|
||||||
|
|
||||||
describe('CommunityPageSubCollectionList Component', () => {
|
describe('CommunityPageSubCollectionListComponent', () => {
|
||||||
let comp: CommunityPageSubCollectionListComponent;
|
let comp: CommunityPageSubCollectionListComponent;
|
||||||
let fixture: ComponentFixture<CommunityPageSubCollectionListComponent>;
|
let fixture: ComponentFixture<CommunityPageSubCollectionListComponent>;
|
||||||
let collectionDataServiceStub: any;
|
let collectionDataServiceStub: any;
|
||||||
@@ -177,19 +177,19 @@ describe('CommunityPageSubCollectionList Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should display a list of collections', () => {
|
it('should display a list of collections', async () => {
|
||||||
waitForAsync(() => {
|
subCollList = collections;
|
||||||
subCollList = collections;
|
fixture.detectChanges();
|
||||||
fixture.detectChanges();
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
const collList = fixture.debugElement.queryAll(By.css('li'));
|
const collList = fixture.debugElement.queryAll(By.css('li'));
|
||||||
expect(collList.length).toEqual(5);
|
expect(collList.length).toEqual(5);
|
||||||
expect(collList[0].nativeElement.textContent).toContain('Collection 1');
|
expect(collList[0].nativeElement.textContent).toContain('Collection 1');
|
||||||
expect(collList[1].nativeElement.textContent).toContain('Collection 2');
|
expect(collList[1].nativeElement.textContent).toContain('Collection 2');
|
||||||
expect(collList[2].nativeElement.textContent).toContain('Collection 3');
|
expect(collList[2].nativeElement.textContent).toContain('Collection 3');
|
||||||
expect(collList[3].nativeElement.textContent).toContain('Collection 4');
|
expect(collList[3].nativeElement.textContent).toContain('Collection 4');
|
||||||
expect(collList[4].nativeElement.textContent).toContain('Collection 5');
|
expect(collList[4].nativeElement.textContent).toContain('Collection 5');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not display the header when list of collections is empty', () => {
|
it('should not display the header when list of collections is empty', () => {
|
||||||
|
@@ -30,7 +30,7 @@ import { SearchConfigurationServiceStub } from '../../shared/testing/search-conf
|
|||||||
import { ConfigurationProperty } from '../../core/shared/configuration-property.model';
|
import { ConfigurationProperty } from '../../core/shared/configuration-property.model';
|
||||||
import { createPaginatedList } from '../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../shared/testing/utils.test';
|
||||||
|
|
||||||
describe('CommunityPageSubCommunityListComponent Component', () => {
|
describe('CommunityPageSubCommunityListComponent', () => {
|
||||||
let comp: CommunityPageSubCommunityListComponent;
|
let comp: CommunityPageSubCommunityListComponent;
|
||||||
let fixture: ComponentFixture<CommunityPageSubCommunityListComponent>;
|
let fixture: ComponentFixture<CommunityPageSubCommunityListComponent>;
|
||||||
let communityDataServiceStub: any;
|
let communityDataServiceStub: any;
|
||||||
@@ -179,19 +179,19 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should display a list of sub-communities', () => {
|
it('should display a list of sub-communities', async () => {
|
||||||
waitForAsync(() => {
|
subCommList = subcommunities;
|
||||||
subCommList = subcommunities;
|
fixture.detectChanges();
|
||||||
fixture.detectChanges();
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
const subComList = fixture.debugElement.queryAll(By.css('li'));
|
const subComList = fixture.debugElement.queryAll(By.css('li'));
|
||||||
expect(subComList.length).toEqual(5);
|
expect(subComList.length).toEqual(5);
|
||||||
expect(subComList[0].nativeElement.textContent).toContain('SubCommunity 1');
|
expect(subComList[0].nativeElement.textContent).toContain('SubCommunity 1');
|
||||||
expect(subComList[1].nativeElement.textContent).toContain('SubCommunity 2');
|
expect(subComList[1].nativeElement.textContent).toContain('SubCommunity 2');
|
||||||
expect(subComList[2].nativeElement.textContent).toContain('SubCommunity 3');
|
expect(subComList[2].nativeElement.textContent).toContain('SubCommunity 3');
|
||||||
expect(subComList[3].nativeElement.textContent).toContain('SubCommunity 4');
|
expect(subComList[3].nativeElement.textContent).toContain('SubCommunity 4');
|
||||||
expect(subComList[4].nativeElement.textContent).toContain('SubCommunity 5');
|
expect(subComList[4].nativeElement.textContent).toContain('SubCommunity 5');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not display the header when list of sub-communities is empty', () => {
|
it('should not display the header when list of sub-communities is empty', () => {
|
||||||
|
@@ -32,7 +32,7 @@ import { SearchConfigurationServiceStub } from '../../shared/testing/search-conf
|
|||||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||||
import { environment } from 'src/environments/environment.test';
|
import { environment } from 'src/environments/environment.test';
|
||||||
|
|
||||||
describe('TopLevelCommunityList Component', () => {
|
describe('TopLevelCommunityListComponent', () => {
|
||||||
let comp: TopLevelCommunityListComponent;
|
let comp: TopLevelCommunityListComponent;
|
||||||
let fixture: ComponentFixture<TopLevelCommunityListComponent>;
|
let fixture: ComponentFixture<TopLevelCommunityListComponent>;
|
||||||
let communityDataServiceStub: any;
|
let communityDataServiceStub: any;
|
||||||
@@ -173,17 +173,17 @@ describe('TopLevelCommunityList Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should display a list of top-communities', () => {
|
it('should display a list of top-communities', async () => {
|
||||||
waitForAsync(() => {
|
await fixture.whenStable();
|
||||||
const subComList = fixture.debugElement.queryAll(By.css('li'));
|
fixture.detectChanges();
|
||||||
|
const subComList = fixture.debugElement.queryAll(By.css('li'));
|
||||||
|
|
||||||
expect(subComList.length).toEqual(5);
|
expect(subComList.length).toEqual(5);
|
||||||
expect(subComList[0].nativeElement.textContent).toContain('TopCommunity 1');
|
expect(subComList[0].nativeElement.textContent).toContain('TopCommunity 1');
|
||||||
expect(subComList[1].nativeElement.textContent).toContain('TopCommunity 2');
|
expect(subComList[1].nativeElement.textContent).toContain('TopCommunity 2');
|
||||||
expect(subComList[2].nativeElement.textContent).toContain('TopCommunity 3');
|
expect(subComList[2].nativeElement.textContent).toContain('TopCommunity 3');
|
||||||
expect(subComList[3].nativeElement.textContent).toContain('TopCommunity 4');
|
expect(subComList[3].nativeElement.textContent).toContain('TopCommunity 4');
|
||||||
expect(subComList[4].nativeElement.textContent).toContain('TopCommunity 5');
|
expect(subComList[4].nativeElement.textContent).toContain('TopCommunity 5');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user