summaryrefslogtreecommitdiff
path: root/spec/frontend/whats_new/components/feature_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/whats_new/components/feature_spec.js')
-rw-r--r--spec/frontend/whats_new/components/feature_spec.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/frontend/whats_new/components/feature_spec.js b/spec/frontend/whats_new/components/feature_spec.js
index 9e9cb59c0d6..8f4b4b08f50 100644
--- a/spec/frontend/whats_new/components/feature_spec.js
+++ b/spec/frontend/whats_new/components/feature_spec.js
@@ -8,7 +8,7 @@ describe("What's new single feature", () => {
const exampleFeature = {
title: 'Compliance pipeline configurations',
body:
- '<p>We are thrilled to announce that it is now possible to define enforceable pipelines that will run for any project assigned a corresponding compliance framework.</p>',
+ '<p data-testid="body-content">We are thrilled to announce that it is now possible to define enforceable pipelines that will run for any project assigned a corresponding <a href="https://en.wikipedia.org/wiki/Compliance_(psychology)" target="_blank" rel="noopener noreferrer" onload="alert(xss)">compliance</a> framework.</p>',
stage: 'Manage',
'self-managed': true,
'gitlab-com': true,
@@ -20,6 +20,7 @@ describe("What's new single feature", () => {
};
const findReleaseDate = () => wrapper.find('[data-testid="release-date"]');
+ const findBodyAnchor = () => wrapper.find('[data-testid="body-content"] a');
const createWrapper = ({ feature } = {}) => {
wrapper = shallowMount(Feature, {
@@ -43,4 +44,13 @@ describe("What's new single feature", () => {
expect(findReleaseDate().exists()).toBe(false);
});
});
+
+ it('safe-html config allows target attribute on elements', () => {
+ createWrapper({ feature: exampleFeature });
+ expect(findBodyAnchor().attributes()).toEqual({
+ href: expect.any(String),
+ rel: 'noopener noreferrer',
+ target: '_blank',
+ });
+ });
});