如何 select b-form-input component using vue test utils library?
How to select b-form-input component using vue test utils library?
我如何select b-form-input 组件根据其类型,如电子邮件、密码..
使用 vue-utils-library 的查找方法?
在我的 login.html
<b-form-input
id="email"
type="email"
v-model="credentials.email"
:class="{ 'is-invalid': submitted && $v.credentials.email.$error }" />
我的包装纸
wrapper = mount(Login,
{
localVue,
store,
mocks: {
$route: {},
$router: {
push: jest.fn()
}
}
})
在我的 test.spec 文件中
it ('select', () => {
const d = wrapper.find('BFormInput[type="email"]')
console.log(d)
})
但是 returns
ErrorWrapper { selector: 'BFormInput[type="email"]' }
我建议你应该这样找到你的输入:
const d = wrapper.find('input.form-control[type="email"]')
我如何select b-form-input 组件根据其类型,如电子邮件、密码..
使用 vue-utils-library 的查找方法?
在我的 login.html
<b-form-input
id="email"
type="email"
v-model="credentials.email"
:class="{ 'is-invalid': submitted && $v.credentials.email.$error }" />
我的包装纸
wrapper = mount(Login,
{
localVue,
store,
mocks: {
$route: {},
$router: {
push: jest.fn()
}
}
})
在我的 test.spec 文件中
it ('select', () => {
const d = wrapper.find('BFormInput[type="email"]')
console.log(d)
})
但是 returns
ErrorWrapper { selector: 'BFormInput[type="email"]' }
我建议你应该这样找到你的输入:
const d = wrapper.find('input.form-control[type="email"]')