Commit fe7dcdd0 authored by Alexander Turinske's avatar Alexander Turinske

Remove default formatting from policy preview comp

- now adding styling is an opt-in process, which works
  better now that there are use cases that do not want
  the styling
parent fac55aa9
......@@ -60,7 +60,7 @@ export default {
<template #default="{ statusLabel }">
<policy-info-row :label="$options.i18n.summary">
<policy-preview-human :policy-description="humanizedPolicy" content-class="" />
<policy-preview-human :policy-description="humanizedPolicy" />
</policy-info-row>
<div v-if="parsedYaml">
......
......@@ -328,7 +328,10 @@ export default {
:id="$options.policyPreviewHumanCollapseId"
v-model="isPolicyPreviewHumanVisible"
>
<policy-preview-human :policy-description="humanizedPolicy" />
<policy-preview-human
class="gl-bg-gray-10 gl-py-3 gl-px-4"
:policy-description="humanizedPolicy"
/>
</gl-collapse>
</div>
</template>
......
......@@ -18,22 +18,13 @@ export default {
required: false,
default: '',
},
contentClass: {
type: String,
required: false,
default: 'gl-bg-gray-10 gl-py-3 gl-px-4',
},
},
safeHtmlConfig: { ALLOWED_TAGS: ['strong', 'br'] },
};
</script>
<template>
<div
v-if="policyDescription"
v-safe-html:[$options.safeHtmlConfig]="policyDescription"
:class="contentClass"
></div>
<div v-if="policyDescription" v-safe-html:[$options.safeHtmlConfig]="policyDescription"></div>
<div v-else>
<gl-alert variant="info" :dismissible="false">
{{ $options.i18n.PARSING_ERROR_MESSAGE }}
......
......@@ -18,7 +18,6 @@ exports[`CiliumNetworkPolicy component supported YAML renders policy preview 1`]
label="Summary"
>
<policy-preview-human-stub
contentclass=""
policydescription="Deny all traffic"
/>
</policy-info-row-stub>
......@@ -61,9 +60,7 @@ exports[`CiliumNetworkPolicy component unsupported YAML renders policy preview 1
<policy-info-row-stub
label="Summary"
>
<policy-preview-human-stub
contentclass=""
/>
<policy-preview-human-stub />
</policy-info-row-stub>
<!---->
......
......@@ -50,10 +50,7 @@ describe('CiliumNetworkPolicy component', () => {
});
it('does render the policy preview', () => {
expect(findPolicyPreview().props()).toStrictEqual({
contentClass: '',
policyDescription: 'Deny all traffic',
});
expect(findPolicyPreview().props('policyDescription')).toBe('Deny all traffic');
});
});
......@@ -72,10 +69,7 @@ describe('CiliumNetworkPolicy component', () => {
it('does render the policy preview', () => {
expect(findPolicyPreview().exists()).toBe(true);
expect(findPolicyPreview().props()).toStrictEqual({
contentClass: '',
policyDescription: null,
});
expect(findPolicyPreview().props('policyDescription')).toBe(null);
});
});
......
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