Skip to content

Commit c2bbc99

Browse files
committed
[UXP-114] Restore markdown-viewer.component for text-section.component
1 parent 645ce35 commit c2bbc99

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/app/shared/explore/section-component/text-section/text-section.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<div *ngSwitchCase="'image'"><img [src]="textRowSection.content" style="width: 100%"></div>
33
<div *ngSwitchCase="'text-key'">{{ ('explore.text-section.' + textRowSection.content) | translate }}</div>
44
<div *ngSwitchCase="'text-raw'">{{ textRowSection.content }}</div>
5-
<div *ngSwitchCase="'text-metadata'" [innerHTML]="metadataValue(textRowSection.content)" [class.text-section-home-news]="textRowSection.content === 'cris.cms.home-news'"></div>
5+
<div *ngSwitchCase="'text-metadata'" [class.text-section-home-news]="textRowSection.content === 'cris.cms.home-news'">
6+
<ds-markdown-viewer data-test="ds-markdown-viewer"
7+
[value]="metadataValue(textRowSection.content)"></ds-markdown-viewer>
8+
</div>
69
<div *ngSwitchCase="'custom'">
710
<ng-container *ngTemplateOutlet="custom"></ng-container>
811
</div>

src/app/shared/explore/section-component/text-section/text-section.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { SearchService } from '../../../../core/shared/search/search.service';
22
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
33
import { TextSectionComponent } from './text-section.component';
44
import { Site } from '../../../../core/shared/site.model';
5+
import { By } from '@angular/platform-browser';
56
import { LocaleService } from '../../../../core/locale/locale.service';
67

78
describe('TextSectionComponent', () => {
@@ -61,4 +62,10 @@ describe('TextSectionComponent', () => {
6162
expect(component).toBeTruthy();
6263
});
6364
// FIXME: complete scenarios
65+
it('should render text-metadata with ds-markdown-viewer', () => {
66+
component.sectionId = 'site';
67+
fixture.detectChanges();
68+
const dsMarkdownViewer = fixture.debugElement.query(By.css('[data-test="ds-markdown-viewer"]'));
69+
expect(dsMarkdownViewer).toBeTruthy();
70+
});
6471
});

0 commit comments

Comments
 (0)