Skip to content

Commit d40b51b

Browse files
committed
test coverage for mixed usage warning
1 parent 3d17807 commit d40b51b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/compiler/compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ function compileDirectives (attrs, options) {
621621
return attr.name === ':class' || attr.name === 'v-bind:class'
622622
})) {
623623
_.warn(
624-
name + '="' + rawValue + '": Do not mix mustache interpolation ' +
624+
'class="' + rawValue + '": Do not mix mustache interpolation ' +
625625
'and v-bind for "class" on the same element. Use one or the other.'
626626
)
627627
}

test/unit/specs/compiler/compile_spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,17 @@ if (_.inBrowser) {
517517
expect(hasWarned(_, 'attribute interpolation is not allowed in Vue.js directives')).toBe(true)
518518
})
519519

520+
it('attribute interpolation: warn mixed usage with v-bind', function () {
521+
new Vue({
522+
el: el,
523+
template: '<div class="{{a}}" :class="bcd"></div>',
524+
data: {
525+
a: 'hi'
526+
}
527+
})
528+
expect(hasWarned(_, 'Do not mix mustache interpolation and v-bind')).toBe(true)
529+
})
530+
520531
it('warn directives on fragment instances', function () {
521532
new Vue({
522533
el: el,

0 commit comments

Comments
 (0)