debian-mirror-gitlab/spec/frontend/notebook/cells/output/html_spec.js

32 lines
762 B
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
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,
2019-03-02 22:35:43 +05:30
count: 0,
index: 0,
2018-03-17 18:26:18 +05:30
},
}).$mount();
}
describe('sanitizes output', () => {
2018-12-13 13:39:08 +05:30
Object.keys(sanitizeTests).forEach(key => {
2018-03-17 18:26:18 +05:30
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();
});
});
});
});