Evan You hace 9 años
padre
commit
93342d7b96

+ 11 - 0
test/unit/modules/compiler/compiler-options.spec.js

@@ -114,4 +114,15 @@ describe('compile options', () => {
     expect(vm.$el.innerHTML).toBe('<input type="text">')
     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('<div v-if="a----">{{ b++++ }}</div>')
+    expect(compiled.errors.length).toBe(2)
+    expect(compiled.errors[0]).toContain('invalid expression: v-if="a----"')
+    expect(compiled.errors[1]).toContain('invalid expression: {{ b++++ }}')
+  })
 })

+ 6 - 0
test/unit/modules/vdom/patch/element.spec.js

@@ -22,6 +22,12 @@ describe('element', () => {
     expect(`Unknown custom element: <unknown>`).toHaveBeenWarned()
   })
 
+  it('should warn unknown element with hyphen', () => {
+    const vnode = new VNode('unknown-foo')
+    patch(null, vnode)
+    expect(`Unknown custom element: <unknown-foo>`).toHaveBeenWarned()
+  })
+
   it('should create an elements which having text content', () => {
     const vnode = new VNode('div', {}, [createTextVNode('hello world')])
     const elm = patch(null, vnode)