gitlab-org--gitlab-foss/spec/javascripts/notebook/cells/output/html_spec.js
Phil Hughes 54636e1d42 Merge branch 'fl-ipythin-10-3' into 'security-10-3'
Port of [10.2] Sanitizes IPython notebook output

See merge request gitlab/gitlabhq!2285

(cherry picked from commit 1c46e031c70706450a8e0ae730f4c323b72f9e4c)

aac035fe Port of [10.2] Sanitizes IPython notebook output
2018-01-16 17:05:01 -08:00

29 lines
728 B
JavaScript

import Vue from 'vue';
import htmlOutput from '~/notebook/cells/output/html.vue';
import sanitizeTests from './html_sanitize_tests';
describe('html output cell', () => {
function createComponent(rawCode) {
const Component = Vue.extend(htmlOutput);
return new Component({
propsData: {
rawCode,
},
}).$mount();
}
describe('sanitizes output', () => {
Object.keys(sanitizeTests).forEach((key) => {
it(key, () => {
const test = sanitizeTests[key];
const vm = createComponent(test.input);
const outputEl = [...vm.$el.querySelectorAll('div')].pop();
expect(outputEl.innerHTML).toEqual(test.output);
vm.$destroy();
});
});
});
});