From 841fe6028a11c469356f962eea8c21555cd9d447 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 5 Apr 2017 13:36:51 +0800 Subject: [PATCH] test computed property conflict warnings --- test/unit/features/options/computed.spec.js | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/unit/features/options/computed.spec.js b/test/unit/features/options/computed.spec.js index 9997c0b9..d4515b01 100644 --- a/test/unit/features/options/computed.spec.js +++ b/test/unit/features/options/computed.spec.js @@ -167,4 +167,27 @@ describe('Options computed', () => { expect(vm.$el.textContent).toBe('3 4') }).then(done) }) + + it('warn conflict with data', () => { + new Vue({ + data: { + a: 1 + }, + computed: { + a: () => 2 + } + }) + expect(`computed property "a" is already defined in data`).toHaveBeenWarned() + }) + + it('warn conflict with props', () => { + new Vue({ + props: ['a'], + propsData: { a: 1 }, + computed: { + a: () => 2 + } + }) + expect(`computed property "a" is already defined as a prop`).toHaveBeenWarned() + }) })