mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 13:07:40 +08:00
improve coverage
This commit is contained in:
parent
7913a96ccb
commit
563cdba11e
@ -26,13 +26,6 @@ export function addDirective (
|
||||
(el.directives || (el.directives = [])).push({ name, value, arg, modifiers })
|
||||
}
|
||||
|
||||
export function addStyleBinding (el: ASTElement, name: string, value: string) {
|
||||
const code = `"${name}":${value}`
|
||||
el.styleBinding = el.styleBinding
|
||||
? el.styleBinding.replace(/}\s?$/, `,${code}}`)
|
||||
: `{${code}}`
|
||||
}
|
||||
|
||||
export function addHook (el: ASTElement, name: string, code: string) {
|
||||
const hooks = el.hooks || (el.hooks = {})
|
||||
const hook = hooks[name]
|
||||
|
@ -29,6 +29,7 @@ export function initMixin (Vue: Class<Component>) {
|
||||
vm
|
||||
)
|
||||
}
|
||||
/* istanbul ignore else */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
initProxy(vm)
|
||||
} else {
|
||||
|
@ -108,6 +108,8 @@ function protoAugment (target, src: Object) {
|
||||
/**
|
||||
* Augment an target Object or Array by defining
|
||||
* hidden properties.
|
||||
*
|
||||
* istanbul ignore next
|
||||
*/
|
||||
function copyAugment (target: Object, src: Object, keys: Array<string>) {
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
|
@ -39,7 +39,7 @@ export const nextTick = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
/* istanbul ignore else */
|
||||
if (typeof MutationObserver !== 'undefined' && !(isWechat && isIos)) {
|
||||
let counter = 1
|
||||
const observer = new MutationObserver(nextTickHandler)
|
||||
|
@ -36,6 +36,7 @@ export default {
|
||||
el.addEventListener('compositionstart', onCompositionStart)
|
||||
el.addEventListener('compositionend', onCompositionEnd)
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (isIE9) {
|
||||
el.vmodel = true
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ function genClassFromData (data: Object): string {
|
||||
if (staticClass || dynamicClass) {
|
||||
return concat(staticClass, stringifyClass(dynamicClass))
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
return ''
|
||||
}
|
||||
|
||||
@ -66,5 +67,6 @@ export function stringifyClass (value: any): string {
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
return res
|
||||
}
|
||||
|
@ -66,10 +66,12 @@ export function getTagNamespace (tag: string): ?string {
|
||||
|
||||
const unknownElementCache = Object.create(null)
|
||||
export function isUnknownElement (tag: string): boolean {
|
||||
/* istanbul ignore if */
|
||||
if (!inBrowser) {
|
||||
return true
|
||||
}
|
||||
tag = tag.toLowerCase()
|
||||
/* istanbul ignore if */
|
||||
if (unknownElementCache[tag] != null) {
|
||||
return unknownElementCache[tag]
|
||||
}
|
||||
|
@ -62,4 +62,9 @@ describe('Options el', () => {
|
||||
expect(vm.$el.childNodes[0].getAttribute('fill')).toBe(vm.color)
|
||||
expect(vm.$el.childNodes[0].textContent).toBe(vm.text)
|
||||
})
|
||||
|
||||
it('warn cannot find element', () => {
|
||||
new Vue({ el: '#non-existent' })
|
||||
expect('Cannot find element: #non-existent').toHaveBeenWarned()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user