Skip to content
代码片段 群组 项目
未验证 提交 dba98cc0 编辑于 作者: Jose Ivan Vargas's avatar Jose Ivan Vargas 提交者: GitLab
浏览文件

Merge branch 'ph/notebookCellsMarkdownVue3SpecFix' into 'master'

Fixes the notebook/cells/markdown_spec Vue 3 failing spec

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181812



Merged-by: default avatarJose Ivan Vargas <jvargas@gitlab.com>
Approved-by: default avatarJose Ivan Vargas <jvargas@gitlab.com>
Co-authored-by: default avatarPhil Hughes <me@iamphill.com>
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
...@@ -166,7 +166,6 @@ spec/frontend/ml/model_registry/apps/show_ml_model_spec.js ...@@ -166,7 +166,6 @@ spec/frontend/ml/model_registry/apps/show_ml_model_spec.js
spec/frontend/ml/model_registry/components/candidate_detail_spec.js spec/frontend/ml/model_registry/components/candidate_detail_spec.js
spec/frontend/ml/model_registry/components/model_edit_spec.js spec/frontend/ml/model_registry/components/model_edit_spec.js
spec/frontend/ml/model_registry/components/model_version_create_spec.js spec/frontend/ml/model_registry/components/model_version_create_spec.js
spec/frontend/notebook/cells/markdown_spec.js
spec/frontend/notes/components/discussion_notes_spec.js spec/frontend/notes/components/discussion_notes_spec.js
spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_row_spec.js
spec/frontend/packages_and_registries/dependency_proxy/app_spec.js spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
......
...@@ -80,26 +80,26 @@ describe('Markdown component', () => { ...@@ -80,26 +80,26 @@ describe('Markdown component', () => {
expect(wrapper.vm.$el.querySelector('.markdown h1')).not.toBeNull(); expect(wrapper.vm.$el.querySelector('.markdown h1')).not.toBeNull();
}); });
it('sanitizes Markdown output', async () => { it('sanitizes Markdown output', () => {
Object.assign(cell, { wrapper = buildCellComponent({
cell_type: 'markdown',
source: [ source: [
'[XSS](data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+Cg==)\n', '[XSS](data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+Cg==)\n',
], ],
}); });
await nextTick(); expect(wrapper.find('a').attributes('href')).toBeUndefined();
expect(wrapper.vm.$el.querySelector('a').getAttribute('href')).toBeNull();
}); });
it('sanitizes HTML', async () => { it('sanitizes HTML', () => {
const findLink = () => wrapper.vm.$el.querySelector('.xss-link'); wrapper = buildCellComponent({
Object.assign(cell, { cell_type: 'markdown',
source: ['<a href="test.js" data-remote=true data-type="script" class="xss-link">XSS</a>\n'], source: ['<a href="test.js" data-remote=true data-type="script" class="xss-link">XSS</a>\n'],
}); });
await nextTick(); const sanitizedLinkAttributes = wrapper.find('.xss-link').attributes();
expect(findLink().dataset.remote).toBeUndefined(); expect(sanitizedLinkAttributes['data-remote']).toBeUndefined();
expect(findLink().dataset.type).toBeUndefined(); expect(sanitizedLinkAttributes['data-type']).toBeUndefined();
}); });
describe('When parsing images', () => { describe('When parsing images', () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册