It might be a little dangerous to trigger the event here, but it seems to work, and stubbing the window doesn't necessarily seem quite right. So lets go with it for now.

My only other comment is that we can combine this with the other _onWindowClose test which I'll push in a minute (have checked with @tOkeshu that the diff is ok).