fix(runtime-core): allow classes to be passed as plugins (#588)

This commit is contained in:
Kael
2020-01-09 04:40:24 +11:00
committed by Evan You
parent 453e6889da
commit 8f616a89c5
2 changed files with 13 additions and 6 deletions

View File

@@ -244,11 +244,18 @@ describe('api: createApp', () => {
const PluginB: Plugin = {
install: (app, arg1, arg2) => app.provide('bar', arg1 + arg2)
}
const PluginC: any = undefined
class PluginC {
someProperty = {}
static install() {
app.provide('baz', 2)
}
}
const PluginD: any = undefined
const app = createApp()
app.use(PluginA)
app.use(PluginB, 1, 1)
app.use(PluginC)
const Root = {
setup() {
@@ -266,7 +273,7 @@ describe('api: createApp', () => {
`Plugin has already been applied to target app`
).toHaveBeenWarnedTimes(1)
app.use(PluginC)
app.use(PluginD)
expect(
`A plugin must either be a function or an object with an "install" ` +
`function.`