mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +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,10 +177,11 @@ 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);
|
||||||
@@ -190,7 +191,6 @@ describe('CommunityPageSubCollectionList Component', () => {
|
|||||||
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', () => {
|
||||||
subCollList = [];
|
subCollList = [];
|
||||||
|
@@ -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,10 +179,11 @@ 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);
|
||||||
@@ -192,7 +193,6 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
|
|||||||
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', () => {
|
||||||
subCommList = [];
|
subCommList = [];
|
||||||
|
@@ -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,8 +173,9 @@ describe('TopLevelCommunityList Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should display a list of top-communities', () => {
|
it('should display a list of top-communities', async () => {
|
||||||
waitForAsync(() => {
|
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);
|
||||||
@@ -184,6 +185,5 @@ describe('TopLevelCommunityList Component', () => {
|
|||||||
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