diff --git a/tests/unit/base.spec.js b/tests/unit/base.spec.js index 48ff00621..83b3ceca2 100644 --- a/tests/unit/base.spec.js +++ b/tests/unit/base.spec.js @@ -255,15 +255,40 @@ describe('left-toolbars测试', () => { describe('xssOptions test', () => { it('xssOptions is enabled by default', async () => { - let xssCode = `#"> `; - let htmlValue = `

<a$ #"> <a$
\n

` + let xssCode = `#"> `; + let htmlValue = `

<a$ #"> <a$
\n

` + let wrapper = new factory({ d_words: null, value: '' }); + + const textInput = wrapper.find('textarea') + await textInput.setValue(xssCode) + + expect(wrapper.find(textValueClass).text()).toEqual(xssCode); + expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); + }); + + it('disable xssOptions', async () => { + let xssCode = `#"> `; + let htmlValue = `

<a$ #"> <a$
\n

` + let wrapper = new factory({ d_words: null, value: '', xssOptions: false }); + + const textInput = wrapper.find('textarea') + await textInput.setValue(xssCode) + + expect(wrapper.find(textValueClass).text()).toEqual(xssCode); + expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); + }); +}); + +describe('local images upload', () => { + it('upload images', async () => { + let textValue = `![gh.png](1)`; + let htmlValue = `

\"gh.png\"

` let wrapper = new factory({ d_words: null, value: '' }); const textInput = wrapper.find('textarea') - await textInput.setValue(xssCode) - wrapper.vm.$nextTick(() => { - expect(wrapper.find(textValueClass).text()).toEqual(xssCode); - expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); - }); + await textInput.setValue(textValue) + + expect(wrapper.find(textValueClass).text()).toEqual(textValue); + expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); }); });