Browse Source

fix coverage

dev
Evan You 9 years ago
parent
commit
93342d7b96
  1. 11
      test/unit/modules/compiler/compiler-options.spec.js
  2. 6
      test/unit/modules/vdom/patch/element.spec.js

11
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.$el.innerHTML).toBe('<input type="text">')
expect(vm.$children[0].valid).toBe(true) 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
test/unit/modules/vdom/patch/element.spec.js

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

Loading…
Cancel
Save