Skip to content

Commit

Permalink
Add missing component: description-display
Browse files Browse the repository at this point in the history
Refs #2320
  • Loading branch information
kimrutherford committed Jan 23, 2025
1 parent 6bf0ba2 commit 2709861
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
Empty file.
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>

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();
});
});
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() {
}

}

0 comments on commit 2709861

Please sign in to comment.