Add detachEventHandler in test