Skip to content

Commit df248f3

Browse files
author
Hiroki Osame
committed
test(Injected properties): Ensures prototype properties aren't injected
Prototype properties were being injected, so injecting 'constructor' would have hit the first provide-layer and not yield expected results. fix vuejs#7284
1 parent 9d4b0c3 commit df248f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/unit/features/options/inject.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,16 @@ describe('Options provide/inject', () => {
635635

636636
expect(injected).toEqual('foo')
637637
})
638+
639+
// #7284
640+
it('should not inject prototype properties', () => {
641+
const vm = new Vue({
642+
provide: {}
643+
})
644+
new Vue({
645+
parent: vm,
646+
inject: ['constructor']
647+
})
648+
expect(`Injection "constructor" not found`).toHaveBeenWarned()
649+
})
638650
})

0 commit comments

Comments
 (0)