test: 100% vue packages coverage (#1371)
This commit is contained in:
parent
ee60a0967f
commit
79686e90e2
@ -98,4 +98,24 @@ describe('compiler + runtime integration', () => {
|
|||||||
app.mount(container)
|
app.mount(container)
|
||||||
expect(container.innerHTML).toBe('hello')
|
expect(container.innerHTML).toBe('hello')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should warn when template is not avaiable', () => {
|
||||||
|
const app = createApp({
|
||||||
|
template: {}
|
||||||
|
})
|
||||||
|
const container = document.createElement('div')
|
||||||
|
app.mount(container)
|
||||||
|
expect('[Vue warn]: invalid template option:').toHaveBeenWarned()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should warn when template is is not found', () => {
|
||||||
|
const app = createApp({
|
||||||
|
template: '#not-exist-id'
|
||||||
|
})
|
||||||
|
const container = document.createElement('div')
|
||||||
|
app.mount(container)
|
||||||
|
expect(
|
||||||
|
'[Vue warn]: Template element not found or is empty: #not-exist-id'
|
||||||
|
).toHaveBeenWarned()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -56,6 +56,7 @@ function compileToFunction(
|
|||||||
)
|
)
|
||||||
warn(codeFrame ? `${message}\n${codeFrame}` : message)
|
warn(codeFrame ? `${message}\n${codeFrame}` : message)
|
||||||
} else {
|
} else {
|
||||||
|
/* istanbul ignore next */
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user