Fix unit tests and jshint errors. Add ability for non-autodismiss dialogs to dispatch events rather than the caller having to directly handle the Esc key and click events.