Skip to content

Commit

Permalink
test(Injected properties): Ensures prototype properties aren't injected
Browse files Browse the repository at this point in the history
Prototype properties were being injected, so injecting 'constructor' would have hit the first
provide-layer and not yield expected results.

fix vuejs#7284
  • Loading branch information
Hiroki Osame committed Jan 16, 2018
1 parent 9d4b0c3 commit df248f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/features/options/inject.spec.js
Expand Up @@ -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()
})
})

0 comments on commit df248f3

Please sign in to comment.