).toMatchInlineSnapshot(`"\`<div id=\\"foo\\" class=\\"bar\\"></div>\`"`)
})
+ test('ignore static key/ref', () => {
+ expect(
+ getCompiledString(`<div key="1" ref="el"></div>`)
+ ).toMatchInlineSnapshot(`"\`<div></div>\`"`)
+ })
+
+ test('ignore v-bind key/ref', () => {
+ expect(
+ getCompiledString(`<div :key="1" :ref="el"></div>`)
+ ).toMatchInlineSnapshot(`"\`<div></div>\`"`)
+ })
+
test('v-bind:class', () => {
expect(getCompiledString(`<div id="foo" :class="bar"></div>`))
.toMatchInlineSnapshot(`
`)
})
- test('v-bind:key (boolean)', () => {
+ test('v-bind:arg (boolean)', () => {
expect(getCompiledString(`<input type="checkbox" :checked="checked">`))
.toMatchInlineSnapshot(`
"\`<input type=\\"checkbox\\"\${
`)
})
- test('v-bind:key (non-boolean)', () => {
+ test('v-bind:arg (non-boolean)', () => {
expect(getCompiledString(`<div :id="id" class="bar"></div>`))
.toMatchInlineSnapshot(`
"\`<div\${
`)
})
- test('v-bind:[key]', () => {
+ test('v-bind:[arg]', () => {
expect(getCompiledString(`<div v-bind:[key]="value"></div>`))
.toMatchInlineSnapshot(`
"\`<div\${
if (isStaticExp(key)) {
let attrName = key.content
// static key attr
+ if (attrName === 'key' || attrName === 'ref') {
+ continue
+ }
if (attrName === 'class') {
openTag.push(
` class="`,
if (node.tag === 'textarea' && prop.name === 'value' && prop.value) {
rawChildrenMap.set(node, escapeHtml(prop.value.content))
} else if (!hasDynamicVBind) {
+ if (prop.name === 'key' || prop.name === 'ref') {
+ continue
+ }
// static prop
if (prop.name === 'class' && prop.value) {
staticClassBinding = JSON.stringify(prop.value.content)