mirror of https://github.com/vuejs/vue.git
test: improve coverage
This commit is contained in:
parent
92a5e93ad0
commit
e0ca894dfb
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ export default {
|
|||
if (!hasTransition) {
|
||||
return false
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (this._hasMove) {
|
||||
return this._hasMove
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue