From d40b51b4c100e6c8c67cce5287dfc1730efcded0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 4 Nov 2015 22:43:46 -0500 Subject: [PATCH] test coverage for mixed usage warning --- src/compiler/compile.js | 2 +- test/unit/specs/compiler/compile_spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile.js b/src/compiler/compile.js index fe49a9516..ded50d8af 100644 --- a/src/compiler/compile.js +++ b/src/compiler/compile.js @@ -621,7 +621,7 @@ function compileDirectives (attrs, options) { return attr.name === ':class' || attr.name === 'v-bind:class' })) { _.warn( - name + '="' + rawValue + '": Do not mix mustache interpolation ' + + 'class="' + rawValue + '": Do not mix mustache interpolation ' + 'and v-bind for "class" on the same element. Use one or the other.' ) } diff --git a/test/unit/specs/compiler/compile_spec.js b/test/unit/specs/compiler/compile_spec.js index 63c28d909..8412bb35d 100644 --- a/test/unit/specs/compiler/compile_spec.js +++ b/test/unit/specs/compiler/compile_spec.js @@ -517,6 +517,17 @@ if (_.inBrowser) { expect(hasWarned(_, 'attribute interpolation is not allowed in Vue.js directives')).toBe(true) }) + it('attribute interpolation: warn mixed usage with v-bind', function () { + new Vue({ + el: el, + template: '
', + data: { + a: 'hi' + } + }) + expect(hasWarned(_, 'Do not mix mustache interpolation and v-bind')).toBe(true) + }) + it('warn directives on fragment instances', function () { new Vue({ el: el,