Comments (1)
问题一:
对于前置方法 都需要假定它是没有问题的
这里的 closeCommandModal
就是前置方法
不然在写其他 test case 的时候就没法写了
因为基于前门准备数据必须要调用除了需要测试接口之外的接口
举个例子 在测试 removeTodo
的时候 就需要先调用 addTodo
如果你不假设 addTodo
是正确的话 那么 removeTodo
也就没法测
对于是调用 closeCommandModal
还是直接赋值 showCommandModal.value = false
在这个 case 中区别不大 看自己的喜好
问题二:
这里主要是为了和测试 openCommandModal
对齐
调用一个接口 然后验证其输出
从可读性上来讲 没啥问题
如果是要提前加 openCommandModal
的话 ,也挺好, 不过在测试 openCommandModal
的时候,也需要调用下 closeCommandModal
使其对齐
it('should be open command modal', () => {
const { openCommandModal, showCommandModal, closeCommandModal } = useCommandModal()
closeCommandModal()
openCommandModal()
expect(showCommandModal.value).toBe(true)
})
至于为什么在 beforeEach 里面都调用了 closeCommandModal
了 现在为什么还需要调用一次
是因为职责不一样, beforeEach 是为了 reset data , 而这里是明确一个前置动作
from dida.
Related Issues (20)
- 拖拽侧边栏的时候会错位
- 编辑完任务的内容后 保存数据有问题 HOT 2
- 保存拖拽后的 task 位置 HOT 5
- 实现任务可移动到其他 project 功能
- 探索 如何把本地的数据保存到 gist 上 HOT 3
- 访问项目正式环境报错,无法加载页面 HOT 4
- 无法创建清单 HOT 2
- 左侧清单列表在点击设置后,会产生错误的冗余数据
- 从设置面板回到主页面后,project 列表错乱
- 创建project之后 当前 active 的 project 应该是新创建的 project HOT 1
- task 在垃圾桶和完成 project 里面不运行拖拽
- 垃圾桶 task 右键中移动到和删除的功能有动画但没有实质效果 HOT 2
- 实现垃圾桶的恢复和永久删除功能
- 保存拖拽后的 task 位置,有一点疑问? HOT 3
- 清单名称可以重复 HOT 2
- feat: Support multiple languages HOT 3
- 初次进入页面 没有显示默认清单
- 快速输入 title 时,会自动聚焦到最前方
- 没有 demo 用户名密码,注册也有问题,没法体验
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dida.