Unit testing 单元测试VueJS Karma Mocha ExpectJS nextTick不工作
我有一个带有密码字段的简单表单。如果密码输入字段为空,则显示此范围:Unit testing 单元测试VueJS Karma Mocha ExpectJS nextTick不工作,unit-testing,vue.js,vuejs2,vue-component,karma-mocha,Unit Testing,Vue.js,Vuejs2,Vue Component,Karma Mocha,我有一个带有密码字段的简单表单。如果密码输入字段为空,则显示此范围: <span id='password-required' v-show='!validation.password'>Required</span> (失败的测试将被注释掉。) 我发现解决方案是将密码数据传递到组件构造函数中,因为它像这样绑定到输入标记 let thePassword = '123' // Extend the component to get the constructor, wh
<span id='password-required' v-show='!validation.password'>Required</span>
(失败的测试将被注释掉。)
我发现解决方案是将密码数据传递到组件构造函数中,因为它像这样绑定到输入标记
let thePassword = '123'
// Extend the component to get the constructor, which we can then initialize directly.
const Constructor = Vue.extend(Signup)
const component = new Constructor({
propsData: {
emailentry: email
},
data: {
password: thePassword
}
}).$mount()
现在测试正在进行中
let thePassword = '123'
// Extend the component to get the constructor, which we can then initialize directly.
const Constructor = Vue.extend(Signup)
const component = new Constructor({
propsData: {
emailentry: email
},
data: {
password: thePassword
}
}).$mount()