-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing component: description-display
Refs #2320
- Loading branch information
1 parent
6bf0ba2
commit 2709861
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
5 changes: 5 additions & 0 deletions
5
src/app/shared/description-display/description-display.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span *ngIf="descriptionParts.length == 0">{{description}}</span> | ||
<span *ngIf="descriptionParts.length != 0"> | ||
<span *ngFor="let part of descriptionParts"><span *ngIf="part.text" [innerHTML]="part.text"></span><a *ngIf="part.termid" routerLink="/term/{{part.termid}}">{{part.termid}}</a></span> | ||
</span> | ||
|
25 changes: 25 additions & 0 deletions
25
src/app/shared/description-display/description-display.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { QueryDescriptionDisplayComponent } from './query-description-display.component'; | ||
|
||
describe('QueryDescriptionDisplayComponent', () => { | ||
let component: QueryDescriptionDisplayComponent; | ||
let fixture: ComponentFixture<QueryDescriptionDisplayComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ QueryDescriptionDisplayComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(QueryDescriptionDisplayComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
src/app/shared/description-display/description-display.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
import { TextOrTermId } from '../util'; | ||
|
||
@Component({ | ||
selector: 'app-description-display', | ||
templateUrl: './description-display.component.html', | ||
styleUrls: ['./description-display.component.css'], | ||
standalone: false | ||
}) | ||
export class DescriptionDisplayComponent implements OnInit { | ||
@Input() description: string; | ||
|
||
// a decomposed version of the description as an Array of Objects | ||
// like: [{text: "abnormal cell ... ("}, {term: <a TermShort>}, {text: ")"}, ...] | ||
// which allows the the termids in a description to be linked to the term pages | ||
@Input() descriptionParts: Array<TextOrTermId> = []; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |