2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import htmlOutput from '~/notebook/cells/output/html.vue';
|
2020-10-24 23:57:45 +05:30
|
|
|
import sanitizeTests from './html_sanitize_fixtures';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it.each(sanitizeTests)('sanitizes output for: %p', (name, { input, output }) => {
|
|
|
|
const vm = createComponent(input);
|
|
|
|
const outputEl = [...vm.$el.querySelectorAll('div')].pop();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
expect(outputEl.innerHTML).toEqual(output);
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
vm.$destroy();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
});
|