mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Added specs.
This commit is contained in:
@@ -25,6 +25,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.util
|
|||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
describe('BrowseByMetadataPageComponent', () => {
|
describe('BrowseByMetadataPageComponent', () => {
|
||||||
let comp: BrowseByMetadataPageComponent;
|
let comp: BrowseByMetadataPageComponent;
|
||||||
@@ -104,6 +105,7 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(BrowseByMetadataPageComponent);
|
fixture = TestBed.createComponent(BrowseByMetadataPageComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -118,6 +120,10 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
expect(comp.items$).toBeUndefined();
|
expect(comp.items$).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set embed thumbnail property to true', () => {
|
||||||
|
expect(comp.embedThumbnail).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
describe('when a value is provided', () => {
|
describe('when a value is provided', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const paramsWithValue = {
|
const paramsWithValue = {
|
||||||
@@ -152,7 +158,7 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
field: 'fake-field',
|
field: 'fake-field',
|
||||||
};
|
};
|
||||||
|
|
||||||
result = browseParamsToOptions(paramsScope, paginationOptions, sortOptions, 'author');
|
result = browseParamsToOptions(paramsScope, paginationOptions, sortOptions, 'author', comp.embedThumbnail);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return BrowseEntrySearchOptions with the correct properties', () => {
|
it('should return BrowseEntrySearchOptions with the correct properties', () => {
|
||||||
@@ -163,6 +169,7 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
expect(result.sort.direction).toEqual(SortDirection.ASC);
|
expect(result.sort.direction).toEqual(SortDirection.ASC);
|
||||||
expect(result.sort.field).toEqual('fake-field');
|
expect(result.sort.field).toEqual('fake-field');
|
||||||
expect(result.scope).toEqual('fake-scope');
|
expect(result.scope).toEqual('fake-scope');
|
||||||
|
expect(result.embedThumbnail).toBeTrue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
||||||
@@ -73,11 +74,28 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(JournalIssueSearchResultListElementComponent);
|
fixture = TestBed.createComponent(JournalIssueSearchResultListElementComponent);
|
||||||
journalIssueListElementComponent = fixture.componentInstance;
|
journalIssueListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalIssueListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('When the item has a journal identifier', () => {
|
describe('When the item has a journal identifier', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalIssueListElementComponent.object = mockItemWithMetadata;
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -126,3 +144,39 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalIssueSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalIssueSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(JournalIssueSearchResultListElementComponent);
|
||||||
|
journalIssueListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
||||||
@@ -72,11 +73,27 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(JournalVolumeSearchResultListElementComponent);
|
fixture = TestBed.createComponent(JournalVolumeSearchResultListElementComponent);
|
||||||
journalVolumeListElementComponent = fixture.componentInstance;
|
journalVolumeListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalVolumeListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has a journal title', () => {
|
describe('When the item has a journal title', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -125,3 +142,38 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalVolumeSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(JournalVolumeSearchResultListElementComponent);
|
||||||
|
journalVolumeListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
|||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let journalListElementComponent: JournalSearchResultListElementComponent;
|
let journalListElementComponent: JournalSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
||||||
@@ -68,11 +69,27 @@ describe('JournalSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(JournalSearchResultListElementComponent);
|
fixture = TestBed.createComponent(JournalSearchResultListElementComponent);
|
||||||
journalListElementComponent = fixture.componentInstance;
|
journalListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has an issn', () => {
|
describe('When the item has an issn', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalListElementComponent.object = mockItemWithMetadata;
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -97,3 +114,39 @@ describe('JournalSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(JournalSearchResultListElementComponent);
|
||||||
|
journalListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
|||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
||||||
@@ -66,11 +67,27 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent);
|
fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent);
|
||||||
orgUnitListElementComponent = fixture.componentInstance;
|
orgUnitListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(orgUnitListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has an org unit description', () => {
|
describe('When the item has an org unit description', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
orgUnitListElementComponent.object = mockItemWithMetadata;
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -95,3 +112,39 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('OrgUnitSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [OrgUnitSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(OrgUnitSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent);
|
||||||
|
orgUnitListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let personListElementComponent: PersonSearchResultListElementComponent;
|
let personListElementComponent: PersonSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
||||||
@@ -66,11 +67,27 @@ describe('PersonSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(PersonSearchResultListElementComponent);
|
fixture = TestBed.createComponent(PersonSearchResultListElementComponent);
|
||||||
personListElementComponent = fixture.componentInstance;
|
personListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(personListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has a job title', () => {
|
describe('When the item has a job title', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
personListElementComponent.object = mockItemWithMetadata;
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -95,3 +112,39 @@ describe('PersonSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('PersonSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [PersonSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(PersonSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(PersonSearchResultListElementComponent);
|
||||||
|
personListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -8,6 +8,8 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
||||||
@@ -66,11 +68,27 @@ describe('ProjectSearchResultListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(ProjectSearchResultListElementComponent);
|
fixture = TestBed.createComponent(ProjectSearchResultListElementComponent);
|
||||||
projectListElementComponent = fixture.componentInstance;
|
projectListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
projectListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(projectListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// describe('When the item has a status', () => {
|
// describe('When the item has a status', () => {
|
||||||
// beforeEach(() => {
|
// beforeEach(() => {
|
||||||
// projectListElementComponent.item = mockItemWithMetadata;
|
// projectListElementComponent.item = mockItemWithMetadata;
|
||||||
@@ -95,3 +113,39 @@ describe('ProjectSearchResultListElementComponent', () => {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ProjectSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(ProjectSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(ProjectSearchResultListElementComponent);
|
||||||
|
projectListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
projectListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -48,5 +48,9 @@ describe('ObjectCollectionComponent', () => {
|
|||||||
expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeDefined();
|
expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeDefined();
|
||||||
expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeNull();
|
expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeNull();
|
||||||
});
|
});
|
||||||
|
it('should set fallback placeholder font size during test', () => {
|
||||||
|
objectCollectionComponent.currentMode$ = observableOf(ViewMode.ListElement);
|
||||||
|
expect(fixture.debugElement.query(By.css('thumb-font-3'))).toBeDefined();
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -243,11 +243,11 @@ export class ObjectCollectionComponent implements OnInit {
|
|||||||
setPlaceHolderFontSize() {
|
setPlaceHolderFontSize() {
|
||||||
const width = this.elementRef.nativeElement.offsetWidth;
|
const width = this.elementRef.nativeElement.offsetWidth;
|
||||||
if (width < 750) {
|
if (width < 750) {
|
||||||
this.placeholderFontClass = "thumb-font-1";
|
this.placeholderFontClass = 'thumb-font-1';
|
||||||
} else if (width < 1000) {
|
} else if (width < 1000) {
|
||||||
this.placeholderFontClass = "thumb-font-2";
|
this.placeholderFontClass = 'thumb-font-2';
|
||||||
} else {
|
} else {
|
||||||
this.placeholderFontClass = "thumb-font-3";
|
this.placeholderFontClass = 'thumb-font-3';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../../../truncatable/truncatable.servi
|
|||||||
import { ItemSearchResult } from '../../../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../object-collection/shared/item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock, UNDEFINED_NAME } from '../../../../../mocks/dso-name.service.mock';
|
import { DSONameServiceMock, UNDEFINED_NAME } from '../../../../../mocks/dso-name.service.mock';
|
||||||
|
import { environment } from '../../../../../../../environments/environment';
|
||||||
|
|
||||||
let publicationListElementComponent: ItemSearchResultListElementComponent;
|
let publicationListElementComponent: ItemSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ItemSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ItemSearchResultListElementComponent>;
|
||||||
@@ -76,11 +77,27 @@ describe('ItemListElementComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = true;
|
||||||
fixture = TestBed.createComponent(ItemSearchResultListElementComponent);
|
fixture = TestBed.createComponent(ItemSearchResultListElementComponent);
|
||||||
publicationListElementComponent = fixture.componentInstance;
|
publicationListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
publicationListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(publicationListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has an author', () => {
|
describe('When the item has an author', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
publicationListElementComponent.object = mockItemWithMetadata;
|
publicationListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -189,3 +206,39 @@ describe('ItemListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ItemListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ItemSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(ItemSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
environment.browseBy.showItemThumbnails = false;
|
||||||
|
fixture = TestBed.createComponent(ItemSearchResultListElementComponent);
|
||||||
|
publicationListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showItemThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
publicationListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user