fix(v-model): allow v-model usage on declared custom elements

fix #1699
This commit is contained in:
Evan You
2020-07-27 17:09:21 -04:00
parent 2a633c84ff
commit 71c3c6e2a0
5 changed files with 43 additions and 3 deletions

View File

@@ -115,6 +115,17 @@ describe('compiler: transform v-model', () => {
)
})
test('should allow usage on custom element', () => {
const onError = jest.fn()
const root = transformWithModel('<my-input v-model="model" />', {
onError,
isCustomElement: tag => tag.startsWith('my-')
})
expect(root.helpers).toContain(V_MODEL_TEXT)
expect(onError).not.toHaveBeenCalled()
expect(generate(root).code).toMatchSnapshot()
})
test('should raise error if used file input element', () => {
const onError = jest.fn()
transformWithModel(`<input type="file" v-model="test"/>`, {