It is completely normal, accepted and recommended to use unit testing modules such as JSSpec or Jasmine (there are many others).
Then you can make a UI module, a functional and sometimes even an integration test using tools such as Ghostbuster or Selenium . This allows you to fake custom events and interactions.
Ghostbuster is still quite young, so we don’t know much about “real” needs, but Selenium is an industry standard (I know that it is used by IBM, source: teacher working at IBM).
, , UX. UX User eXperience, , , .