test: improve coverage

This commit is contained in:
Evan You 2017-07-13 13:50:42 +08:00
parent 92a5e93ad0
commit e0ca894dfb
3 changed files with 16 additions and 0 deletions

View File

@ -49,6 +49,7 @@ export function initRender (vm: Component) {
// $attrs & $listeners are exposed for easier HOC creation.
// they need to be reactive so that HOCs using them are always updated
const parentData = parentVnode && parentVnode.data
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive(vm, '$attrs', parentData && parentData.attrs, () => {
!isUpdatingChildComponent && warn(`$attrs is readonly.`, vm)

View File

@ -127,6 +127,7 @@ export default {
if (!hasTransition) {
return false
}
/* istanbul ignore if */
if (this._hasMove) {
return this._hasMove
}

View File

@ -695,4 +695,18 @@ describe('Directive v-on', () => {
expect(mouseup.calls.count()).toBe(1)
expect(mousedown.calls.count()).toBe(1)
})
it('warn object syntax with modifier', () => {
new Vue({
template: `<button v-on.self="{}"></button>`
}).$mount()
expect(`v-on without argument does not support modifiers`).toHaveBeenWarned()
})
it('warn object syntax with non-object value', () => {
new Vue({
template: `<button v-on="123"></button>`
}).$mount()
expect(`v-on without argument expects an Object value`).toHaveBeenWarned()
})
})