fix(runtime-core): instance should not expose non-declared props

This commit is contained in:
Evan You
2020-01-27 14:30:00 -05:00
parent e43f5935b5
commit 2884831065
2 changed files with 25 additions and 6 deletions

View File

@@ -76,6 +76,20 @@ describe('component: proxy', () => {
expect(`Attempting to mutate prop "foo"`).toHaveBeenWarned()
})
test('should not expose non-declared props', () => {
let instanceProxy: any
const Comp = {
setup() {
return () => null
},
mounted() {
instanceProxy = this
}
}
render(h(Comp, { count: 1 }), nodeOps.createElement('div'))
expect('count' in instanceProxy).toBe(false)
})
test('public properties', () => {
let instance: ComponentInternalInstance
let instanceProxy: any