Skip to content
Browse files

Test for #61

  • Loading branch information...
1 parent 45b116a commit c22bed0afefa9547616ed096d71031264902d468 @majek majek committed Apr 24, 2012
Showing with 16 additions and 1 deletion.
  1. +14 −0 tests/html/src/endtoendtests.coffee
  2. +2 −1 tests/html/src/tests.coffee
View
14 tests/html/src/endtoendtests.coffee
@@ -118,3 +118,17 @@ asyncTest "close on close", ->
u.delay 10, ->
start()
+
+# Test for #61
+asyncTest "EventEmitter exception handling", ->
+ expect(1)
+ r = newSockJS('/echo', 'xhr-streaming')
+ prev_onerror = window.onerror
+ window.onerror = (e) ->
+ ok(/onopen error/.test(''+e))
+ window.onerror = prev_onerror
+ r.close()
+ r.onopen = (e) ->
+ throw "onopen error"
+ r.onclose = ->
+ start()
View
3 tests/html/src/tests.coffee
@@ -11,7 +11,8 @@ protocols = ['websocket',
newSockJS = (path, protocol) ->
url = if /^http/.test(path) then path else client_opts.url + path
options = jQuery.extend({}, client_opts.sockjs_opts)
- options.protocols_whitelist = [protocol]
+ if protocol
+ options.protocols_whitelist = [protocol]
return new SockJS(url, null, options)
echo_factory_factory = (protocol, messages) ->

0 comments on commit c22bed0

Please sign in to comment.
Something went wrong with that request. Please try again.