Pull `test.done()` out of `dispatch()`

Leave test.done() in the test itself, where it will be visible and
expected.  Also, this allow draining the event queue multiple times (if
desired) before ending the test.