Added dispatchEvent() wrapper method.
Added a test case for dispatchEvent().