所以,我注意到块it()
内的函数describe()
并不(总是)按照我编写它们的顺序运行。
那么它们是异步的吗?以及如何强制他们按照一定的顺序运行?
我想链接一堆 UI 突变,基本上让每个it()
函数在上一步之后检查 UI 的状态。
如果它们是异步执行的,那就更重要了。这是否意味着每个it()
块都需要包含前一个块中的所有步骤?
it('should do something', function() {
// app is in state 1
// do something
// leave app in state 2
});
it('should continue from the state left after the previous block', function() {
// app is in state 2
// do something
// leave app in state 3
});
it('should continue from the state left after the previous block', function() {
// app is in state 3
// do something
// leave app in state 4
});
it('should continue from the state left after the previous block', function() {
// app is in state 4
// do something
// leave app in state 5
});
...