diff --git a/test/unit/modules/compiler/compiler-options.spec.js b/test/unit/modules/compiler/compiler-options.spec.js index 23936234..a3037ae5 100644 --- a/test/unit/modules/compiler/compiler-options.spec.js +++ b/test/unit/modules/compiler/compiler-options.spec.js @@ -114,4 +114,15 @@ describe('compile options', () => { expect(vm.$el.innerHTML).toBe('') expect(vm.$children[0].valid).toBe(true) }) + + it('should collect errors', () => { + let compiled = compile('hello') + expect(compiled.errors.length).toBe(1) + expect(compiled.errors[0]).toContain('should contain exactly one root element') + + compiled = compile('
{{ b++++ }}
') + expect(compiled.errors.length).toBe(2) + expect(compiled.errors[0]).toContain('invalid expression: v-if="a----"') + expect(compiled.errors[1]).toContain('invalid expression: {{ b++++ }}') + }) }) diff --git a/test/unit/modules/vdom/patch/element.spec.js b/test/unit/modules/vdom/patch/element.spec.js index 5872bdf8..50138697 100644 --- a/test/unit/modules/vdom/patch/element.spec.js +++ b/test/unit/modules/vdom/patch/element.spec.js @@ -22,6 +22,12 @@ describe('element', () => { expect(`Unknown custom element: `).toHaveBeenWarned() }) + it('should warn unknown element with hyphen', () => { + const vnode = new VNode('unknown-foo') + patch(null, vnode) + expect(`Unknown custom element: `).toHaveBeenWarned() + }) + it('should create an elements which having text content', () => { const vnode = new VNode('div', {}, [createTextVNode('hello world')]) const elm = patch(null, vnode)