From e0aeaad91a960026b6e8ab115252d632c30e7e7d Mon Sep 17 00:00:00 2001 From: Raymond Rutjes Date: Tue, 21 Mar 2017 13:04:27 +0100 Subject: [PATCH] fix(inject): change warn message when trying to mutate an injected value --- src/core/instance/inject.js | 4 ++-- test/unit/features/options/inject.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/instance/inject.js b/src/core/instance/inject.js index a2954163140..373827b28af 100644 --- a/src/core/instance/inject.js +++ b/src/core/instance/inject.js @@ -34,9 +34,9 @@ export function initInjections (vm: Component) { if (process.env.NODE_ENV !== 'production') { defineReactive(vm, key, source._provided[provideKey], () => { warn( - `Avoid mutating a injections directly since the value will be ` + + `Avoid mutating an injected value directly since the changes will be ` + `overwritten whenever the provided component re-renders. ` + - `injections being mutated: "${key}"`, + `injection being mutated: "${key}"`, vm ) }) diff --git a/test/unit/features/options/inject.spec.js b/test/unit/features/options/inject.spec.js index bfb5e5bd143..2949e43c750 100644 --- a/test/unit/features/options/inject.spec.js +++ b/test/unit/features/options/inject.spec.js @@ -213,8 +213,8 @@ describe('Options provide/inject', () => { expect(child.foo).toBe(1) child.foo = 2 expect( - `Avoid mutating a injections directly since the value will be ` + + `Avoid mutating an injected value directly since the changes will be ` + `overwritten whenever the provided component re-renders. ` + - `injections being mutated: "${key}"`).toHaveBeenWarned() + `injection being mutated: "${key}"`).toHaveBeenWarned() }) })