fixing tests.

This commit is contained in:
Jason Kulatunga 2023-01-16 17:30:12 -08:00
parent 36902b59e1
commit a2937a42e4
8 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,3 @@
<div>
<pre>{{displayModel.content}}</pre>
<pre>{{displayModel?.content}}</pre>
</div>

View File

@ -1,6 +1,6 @@
<div>
<span>{{coding.display}}</span>
<span *ngIf="has_additional_info" [title]="coding.system">
({{coding.code || '?'}})
<span>{{coding?.display}}</span>
<span *ngIf="has_additional_info" [title]="coding?.system">
({{coding?.code || '?'}})
</span>
</div>

View File

@ -13,7 +13,7 @@ export class HtmlComponent implements OnInit {
constructor(private sanitized: DomSanitizer) { }
ngOnInit(): void {
this.contentMarkup = this.sanitized.bypassSecurityTrustHtml(this.displayModel.content);
this.contentMarkup = this.sanitized.bypassSecurityTrustHtml(this.displayModel?.content);
}

View File

@ -1,3 +1,3 @@
<div>
<img src="data:${{displayModel.content_type}};base64,${{displayModel.data}}" alt=""/>
<img src="data:${{displayModel?.content_type}};base64,${{displayModel?.data}}" alt=""/>
</div>

View File

@ -18,6 +18,8 @@ describe('ImgComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,7 +1,7 @@
<div>
<embed
src="data:${{displayModel.content_type}};base64,${{displayModel.data}}"
type="${{displayModel.content_type}}"
type="${{displayModel?.content_type}}"
[style]="{
width: '100%',
height: height

View File

@ -14,8 +14,11 @@ export class PdfComponent implements OnInit {
ngOnInit(): void {
const maxHeight = 600;
const contentHeight = (1111 * this.displayModel.data.length) / (24996 / 7.5);
this.height = Math.min(maxHeight, contentHeight);
if (this.displayModel){
const contentHeight = (1111 * this.displayModel?.data.length) / (24996 / 7.5);
this.height = Math.min(maxHeight, contentHeight);
}
}
}

View File

@ -1,8 +1,8 @@
<ng-container [ngTemplateOutlet]="
displayModel.content_type == 'application/pdf' ? showPdf :
displayModel.content_type == 'image/jpeg' ? showImg :
(displayModel.content_type == 'text/html' || displayModel.content_type == 'application/html') ? showHtml :
(displayModel.content_type == 'application/xml' || displayModel.content_type == 'application/json') ? showText :
displayModel?.content_type == 'application/pdf' ? showPdf :
displayModel?.content_type == 'image/jpeg' ? showImg :
(displayModel?.content_type == 'text/html' || displayModel?.content_type == 'application/html') ? showHtml :
(displayModel?.content_type == 'application/xml' || displayModel?.content_type == 'application/json') ? showText :
showEmpty
"></ng-container>