Skip to content

Commit d1fc68c

Browse files
atarix83Andrea Barbasso
authored andcommitted
[UXP-114] Restore markdown-viewer.component for text-section.component
1 parent 883f8b5 commit d1fc68c

2 files changed

Lines changed: 7 additions & 4 deletions

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ describe('TextSectionComponent', () => {
6262
expect(component).toBeTruthy();
6363
});
6464
// FIXME: complete scenarios
65-
it('should render text-metadata with innerHtml', () => {
65+
it('should render text-metadata with ds-markdown-viewer', () => {
6666
component.sectionId = 'site';
6767
fixture.detectChanges();
68-
const name = fixture.debugElement.queryAll(By.css('div'))[0].nativeElement;
69-
expect(name.innerHTML).toContain(component.site.metadata['cms.homepage.footer'][0].value);
68+
const dsMarkdownViewer = fixture.debugElement.query(By.css('[data-test="ds-markdown-viewer"]'));
69+
expect(dsMarkdownViewer).toBeTruthy();
7070
});
7171
});

0 commit comments

Comments
 (0)