summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 14:39:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-26 14:39:01 +0000
commitf332982c82ad95ae2ee22242c39f78717613165f (patch)
tree25d49bea1c105fdd7cf62da42d2c91fd9146e9db /spec/frontend
parent25ed7b6ae4712518e96d4719b75dd293c57404a2 (diff)
downloadgitlab-ce-f332982c82ad95ae2ee22242c39f78717613165f.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-3-stable-ee
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/notebook/cells/output/html_sanitize_fixtures.js4
-rw-r--r--spec/frontend/notebook/cells/output/index_spec.js14
2 files changed, 12 insertions, 6 deletions
diff --git a/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js b/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
index 70c7f56b62f..296d01ddd99 100644
--- a/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
+++ b/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
@@ -38,7 +38,7 @@ export default [
'</tr>\n',
'</table>',
].join(''),
- output: '<table>',
+ output: '<table data-myattr=&quot;XSS&quot;>',
},
],
// Note: style is sanitized out
@@ -98,7 +98,7 @@ export default [
'</svg>',
].join(),
output:
- '<svg xmlns="http://www.w3.org/2000/svg" width="388.84pt" version="1.0" id="svg2" height="115.02pt">',
+ '<svg height=&quot;115.02pt&quot; id=&quot;svg2&quot; version=&quot;1.0&quot; width=&quot;388.84pt&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;>',
},
],
];
diff --git a/spec/frontend/notebook/cells/output/index_spec.js b/spec/frontend/notebook/cells/output/index_spec.js
index 4d1d03e5e34..97a7e22be60 100644
--- a/spec/frontend/notebook/cells/output/index_spec.js
+++ b/spec/frontend/notebook/cells/output/index_spec.js
@@ -49,15 +49,17 @@ describe('Output component', () => {
const htmlType = json.cells[4];
createComponent(htmlType.outputs[0]);
- expect(wrapper.findAll('p')).toHaveLength(1);
- expect(wrapper.text()).toContain('test');
+ const iframe = wrapper.find('iframe');
+ expect(iframe.exists()).toBe(true);
+ expect(iframe.element.getAttribute('sandbox')).toBe('');
+ expect(iframe.element.getAttribute('srcdoc')).toBe('<p>test</p>');
});
it('renders multiple raw HTML outputs', () => {
const htmlType = json.cells[4];
createComponent([htmlType.outputs[0], htmlType.outputs[0]]);
- expect(wrapper.findAll('p')).toHaveLength(2);
+ expect(wrapper.findAll('iframe')).toHaveLength(2);
});
});
@@ -84,7 +86,11 @@ describe('Output component', () => {
});
it('renders as an svg', () => {
- expect(wrapper.find('svg').exists()).toBe(true);
+ const iframe = wrapper.find('iframe');
+
+ expect(iframe.exists()).toBe(true);
+ expect(iframe.element.getAttribute('sandbox')).toBe('');
+ expect(iframe.element.getAttribute('srcdoc')).toBe('<svg></svg>');
});
});