await nextTick()
expect(calls).toEqual(['cb1', 'cb2', 'job1'])
})
+
+ // #3806
+ it('queue preFlushCb inside postFlushCb', async () => {
+ const cb = jest.fn()
+ queuePostFlushCb(() => {
+ queuePreFlushCb(cb)
+ })
+ await nextTick()
+ expect(cb).toHaveBeenCalled()
+ })
})
describe('queuePostFlushCb', () => {
currentFlushPromise = null
// some postFlushCb queued jobs!
// keep flushing until it drains.
- if (queue.length || pendingPostFlushCbs.length) {
+ if (
+ queue.length ||
+ pendingPreFlushCbs.length ||
+ pendingPostFlushCbs.length
+ ) {
flushJobs(seen)
}
}