Commit b4e3a822 authored by Fatih Acet's avatar Fatih Acet

Merge branch '209995-snippet-description-md-render' into 'master'

Resolve "code Snippets Description: Markdown is not rendered (it's just plain text)"

Closes #209995

See merge request gitlab-org/gitlab!27038
parents 2ff3906e daf545a2
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
{{ snippet.title }} {{ snippet.title }}
</h2> </h2>
<div v-if="snippet.description" class="description" data-qa-selector="snippet_description"> <div v-if="snippet.description" class="description" data-qa-selector="snippet_description">
<div class="md">{{ snippet.description }}</div> <div class="md js-snippet-description" v-html="snippet.descriptionHtml"></div>
</div> </div>
<small v-if="snippet.updatedAt !== snippet.createdAt" class="edited-text"> <small v-if="snippet.updatedAt !== snippet.createdAt" class="edited-text">
......
...@@ -2,6 +2,7 @@ fragment SnippetBase on Snippet { ...@@ -2,6 +2,7 @@ fragment SnippetBase on Snippet {
id id
title title
description description
descriptionHtml
createdAt createdAt
updatedAt updatedAt
visibilityLevel visibilityLevel
......
...@@ -6,10 +6,12 @@ describe('Snippet header component', () => { ...@@ -6,10 +6,12 @@ describe('Snippet header component', () => {
let wrapper; let wrapper;
const title = 'The property of Thor'; const title = 'The property of Thor';
const description = 'Do not touch this hammer'; const description = 'Do not touch this hammer';
const descriptionHtml = `<h2>${description}</h2>`;
const snippet = { const snippet = {
snippet: { snippet: {
title, title,
description, description,
descriptionHtml,
}, },
}; };
...@@ -35,7 +37,7 @@ describe('Snippet header component', () => { ...@@ -35,7 +37,7 @@ describe('Snippet header component', () => {
it('renders snippets title and description', () => { it('renders snippets title and description', () => {
createComponent(); createComponent();
expect(wrapper.text().trim()).toContain(title); expect(wrapper.text().trim()).toContain(title);
expect(wrapper.text().trim()).toContain(description); expect(wrapper.find('.js-snippet-description').element.innerHTML).toBe(descriptionHtml);
}); });
it('does not render recent changes time stamp if there were no updates', () => { it('does not render recent changes time stamp if there were no updates', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment