Commit 53faa4aa authored by Paul Gascou-Vaillancourt's avatar Paul Gascou-Vaillancourt Committed by Dheeraj Joshi

Render markup in DAST profiles library errors

parent 268cccb0
...@@ -5,6 +5,7 @@ import { ...@@ -5,6 +5,7 @@ import {
GlModal, GlModal,
GlSkeletonLoader, GlSkeletonLoader,
GlTable, GlTable,
GlSafeHtmlDirective,
GlTooltipDirective, GlTooltipDirective,
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
...@@ -26,6 +27,7 @@ export default { ...@@ -26,6 +27,7 @@ export default {
GlIcon, GlIcon,
}, },
directives: { directives: {
SafeHtml: GlSafeHtmlDirective,
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
}, },
props: { props: {
...@@ -164,7 +166,11 @@ export default { ...@@ -164,7 +166,11 @@ export default {
:aria-label="__('DastProfiles|Error Details')" :aria-label="__('DastProfiles|Error Details')"
class="gl-p-0 gl-m-0" class="gl-p-0 gl-m-0"
> >
<li v-for="errorDetail in errorDetails" :key="errorDetail">{{ errorDetail }}</li> <li
v-for="errorDetail in errorDetails"
:key="errorDetail"
v-safe-html="errorDetail"
></li>
</ul> </ul>
</gl-alert> </gl-alert>
</td> </td>
......
...@@ -244,6 +244,17 @@ describe('EE - DastProfilesList', () => { ...@@ -244,6 +244,17 @@ describe('EE - DastProfilesList', () => {
expect(within(getErrorDetails()).getByText(errorDetails[0])).not.toBe(null); expect(within(getErrorDetails()).getByText(errorDetails[0])).not.toBe(null);
expect(within(getErrorDetails()).getByText(errorDetails[1])).not.toBe(null); expect(within(getErrorDetails()).getByText(errorDetails[1])).not.toBe(null);
}); });
it('properly renders errors containing markup', () => {
const errorDetails = ['an error <a href="#">with a link</a>'];
createFullComponent({
propsData: { errorMessage: TEST_ERROR_MESSAGE, errorDetails },
});
expect(getErrorMessage()).not.toBe(null);
expect(getErrorDetails()).not.toBe(null);
expect(within(getErrorDetails()).getByRole('link', { name: 'with a link' })).not.toBe(null);
});
}); });
describe('profile referenced in a security policy', () => { describe('profile referenced in a security policy', () => {
......
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