wip: basic compat test
This commit is contained in:
parent
47b765d63a
commit
3d810eb422
@ -35,6 +35,7 @@ module.exports = {
|
|||||||
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
|
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
|
'@vue/compat': '<rootDir>/packages/vue-compat/src',
|
||||||
'^@vue/(.*?)$': '<rootDir>/packages/$1/src',
|
'^@vue/(.*?)$': '<rootDir>/packages/$1/src',
|
||||||
vue: '<rootDir>/packages/vue/src'
|
vue: '<rootDir>/packages/vue/src'
|
||||||
},
|
},
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import Vue from '@vue/compat'
|
||||||
|
|
||||||
|
test('should work', async () => {
|
||||||
|
const el = document.createElement('div')
|
||||||
|
el.innerHTML = `{{ msg }}`
|
||||||
|
new Vue({
|
||||||
|
el,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
msg: 'hello'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
expect('global app bootstrapping API has changed').toHaveBeenWarned()
|
||||||
|
expect(el.innerHTML).toBe('hello')
|
||||||
|
})
|
@ -1,4 +1,4 @@
|
|||||||
import { isArray } from '@vue/shared/src'
|
import { isArray } from '@vue/shared'
|
||||||
import { ObjectDirective, DirectiveHook } from '../directives'
|
import { ObjectDirective, DirectiveHook } from '../directives'
|
||||||
import { DeprecationTypes, warnDeprecation } from './deprecations'
|
import { DeprecationTypes, warnDeprecation } from './deprecations'
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ const deprecations: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
|
|
||||||
[DeprecationTypes.INSTANCE_MOUNT]: {
|
[DeprecationTypes.INSTANCE_MOUNT]: {
|
||||||
message:
|
message:
|
||||||
`The global app boostrapping API has changed: vm.$mount() and the "el" ` +
|
`The global app bootstrapping API has changed: vm.$mount() and the "el" ` +
|
||||||
`option have been removed. Use createApp(RootComponent).mount() instead.`,
|
`option have been removed. Use createApp(RootComponent).mount() instead.`,
|
||||||
link: `https://v3.vuejs.org/guide/migration/global-api.html#mounting-app-instance`
|
link: `https://v3.vuejs.org/guide/migration/global-api.html#mounting-app-instance`
|
||||||
},
|
},
|
||||||
|
@ -246,7 +246,7 @@ export function installCompatMount(
|
|||||||
if (hasNoRender) {
|
if (hasNoRender) {
|
||||||
instance.render = emptyRender
|
instance.render = emptyRender
|
||||||
}
|
}
|
||||||
setupComponent(instance, __NODE_JS__)
|
setupComponent(instance)
|
||||||
vnode.component = instance
|
vnode.component = instance
|
||||||
|
|
||||||
// $mount & $destroy
|
// $mount & $destroy
|
||||||
@ -312,7 +312,7 @@ export function installCompatMount(
|
|||||||
}
|
}
|
||||||
instance.render = null
|
instance.render = null
|
||||||
;(component as ComponentOptions).template = container.innerHTML
|
;(component as ComponentOptions).template = container.innerHTML
|
||||||
finishComponentSetup(instance, __NODE_JS__, true /* skip options */)
|
finishComponentSetup(instance, false, true /* skip options */)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear content before mounting
|
// clear content before mounting
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"types": ["jest", "puppeteer", "node"],
|
"types": ["jest", "puppeteer", "node"],
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"@vue/compat": ["packages/vue-compat/src"],
|
||||||
"@vue/*": ["packages/*/src"],
|
"@vue/*": ["packages/*/src"],
|
||||||
"vue": ["packages/vue/src"]
|
"vue": ["packages/vue/src"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user