mirror of https://github.com/vuejs/vue.git
test coverage for mixed usage warning
This commit is contained in:
parent
3d17807c8e
commit
d40b51b4c1
|
@ -621,7 +621,7 @@ function compileDirectives (attrs, options) {
|
||||||
return attr.name === ':class' || attr.name === 'v-bind:class'
|
return attr.name === ':class' || attr.name === 'v-bind:class'
|
||||||
})) {
|
})) {
|
||||||
_.warn(
|
_.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.'
|
'and v-bind for "class" on the same element. Use one or the other.'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,6 +517,17 @@ if (_.inBrowser) {
|
||||||
expect(hasWarned(_, 'attribute interpolation is not allowed in Vue.js directives')).toBe(true)
|
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: '<div class="{{a}}" :class="bcd"></div>',
|
||||||
|
data: {
|
||||||
|
a: 'hi'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
expect(hasWarned(_, 'Do not mix mustache interpolation and v-bind')).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
it('warn directives on fragment instances', function () {
|
it('warn directives on fragment instances', function () {
|
||||||
new Vue({
|
new Vue({
|
||||||
el: el,
|
el: el,
|
||||||
|
|
Loading…
Reference in New Issue