Allow passthrough attrs on UrlInput (#2329)

This commit is contained in:
Chenlei Hu
2025-01-23 14:29:38 -05:00
committed by GitHub
parent 3f787e2dbf
commit 93dc50a95a
2 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
import { mount } from '@vue/test-utils'
import PrimeVue from 'primevue/config'
import IconField from 'primevue/iconfield'
import InputIcon from 'primevue/inputicon'
import InputText from 'primevue/inputtext'
import { beforeEach, describe, expect, it } from 'vitest'
import { createApp } from 'vue'
import UrlInput from '../UrlInput.vue'
describe('UrlInput', () => {
beforeEach(() => {
const app = createApp({})
app.use(PrimeVue)
})
it('passes through additional attributes to input element', () => {
const wrapper = mount(UrlInput, {
global: {
plugins: [PrimeVue],
components: { IconField, InputIcon, InputText }
},
props: {
modelValue: '',
placeholder: 'Enter URL',
disabled: true
}
})
expect(wrapper.find('input').attributes('disabled')).toBe('')
})
})