From df248f3924fc726eafe96d291b8612397be4e953 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 15 Jan 2018 16:45:54 -0800 Subject: [PATCH] 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 #7284 --- test/unit/features/options/inject.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/features/options/inject.spec.js b/test/unit/features/options/inject.spec.js index cd5c7097f31..53f55e1ecf2 100644 --- a/test/unit/features/options/inject.spec.js +++ b/test/unit/features/options/inject.spec.js @@ -635,4 +635,16 @@ describe('Options provide/inject', () => { expect(injected).toEqual('foo') }) + + // #7284 + it('should not inject prototype properties', () => { + const vm = new Vue({ + provide: {} + }) + new Vue({ + parent: vm, + inject: ['constructor'] + }) + expect(`Injection "constructor" not found`).toHaveBeenWarned() + }) })