mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00

# Conflicts: # src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.ts # src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.html # src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.ts # src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts # src/app/shared/shared.module.ts # src/app/shared/theme-support/themed.component.ts # src/themes/custom/lazy-theme.module.ts
45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
import { PlainTextMetadataListElementComponent } from './plain-text-metadata-list-element.component';
|
|
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
|
import { By } from '@angular/platform-browser';
|
|
import { mockData } from '../../../testing/browse-definition-data-service.stub';
|
|
|
|
// Render the mock representation with the default mock author browse definition so it is also rendered as a link
|
|
// without affecting other tests
|
|
const mockMetadataRepresentation = Object.assign(new MetadatumRepresentation('type', mockData[1]), {
|
|
key: 'dc.contributor.author',
|
|
value: 'Test Author'
|
|
});
|
|
|
|
describe('PlainTextMetadataListElementComponent', () => {
|
|
let comp: PlainTextMetadataListElementComponent;
|
|
let fixture: ComponentFixture<PlainTextMetadataListElementComponent>;
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
TestBed.configureTestingModule({
|
|
imports: [],
|
|
declarations: [PlainTextMetadataListElementComponent],
|
|
schemas: [NO_ERRORS_SCHEMA]
|
|
}).overrideComponent(PlainTextMetadataListElementComponent, {
|
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
|
}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
fixture = TestBed.createComponent(PlainTextMetadataListElementComponent);
|
|
comp = fixture.componentInstance;
|
|
comp.mdRepresentation = mockMetadataRepresentation;
|
|
fixture.detectChanges();
|
|
}));
|
|
|
|
it('should contain the value as plain text', () => {
|
|
expect(fixture.debugElement.nativeElement.textContent).toContain(mockMetadataRepresentation.value);
|
|
});
|
|
|
|
it('should contain the browse link as plain text', () => {
|
|
expect(fixture.debugElement.query(By.css('a.ds-browse-link')).nativeElement.innerHTML).toContain(mockMetadataRepresentation.value);
|
|
});
|
|
|
|
});
|