May 2024
Beginner to intermediate
384 pages
9h 29m
English
nextTick() functionTesting components whose behavior is purely synchronous is straightforward. But components can have asynchronous hooks or event handlers, so testing them becomes a bit more complicated (and interesting) in these cases.
The main question the tester must face is how you know when all the asynchronous jobs have finished executing and the component has re-rendered. In this chapter, you’ll implement a nextTick() function. This function returns a Promise that resolves when all the pending jobs in the scheduler have finished executing. This way, by awaiting this Promise, you ...