【发布时间】:2019-04-23 23:21:17
【问题描述】:
我有一个 vue 代码,我根据 this.$refs.form.validate 执行一些操作 我想为它写一个测试......但不知道如何模拟 this.$refs.form.validate?我只写了基本的..有人能指出我正确的方向吗?我正在使用 Vue+Jest
methods: {
sayHello () {
if (this.$refs.form.validate()) {
//code goes here
}
有没有办法让它返回 false 和 true?
【问题讨论】: