Add test for loadend event after error.