Skip to content

Commit

Permalink
test: Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusBorg committed Nov 26, 2021
1 parent 7d28b47 commit 0ff055c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/vue-compat/__tests__/global.spec.ts
Expand Up @@ -285,6 +285,28 @@ describe('GLOBAL_PROTOTYPE', () => {
delete Vue.prototype.$test
})

test.only('functions keeps additional properties', () => {
function test(this: any) {
return this.msg
}
test.additionalFn = () => {
return 'additional fn'
}

Vue.prototype.$test = test
const vm = new Vue({
data() {
return {
msg: 'test'
}
}
}) as any
expect(typeof vm.$test).toBe('function')
expect(typeof vm.$test.additionalFn).toBe('function')
expect(vm.$test.additionalFn()).toBe('additional fn')
delete Vue.prototype.$test
})

test('extended prototype', async () => {
const Foo = Vue.extend()
Foo.prototype.$test = 1
Expand Down

0 comments on commit 0ff055c

Please sign in to comment.