diff --git a/test/patch/WebSocket.spec.js b/test/patch/WebSocket.spec.js index d39346ed9..e8db00c13 100644 --- a/test/patch/WebSocket.spec.js +++ b/test/patch/WebSocket.spec.js @@ -18,9 +18,9 @@ describe('WebSocket', function () { it('should work with addEventListener', function (done) { var parent = window.zone; - socket.addEventListener('message', function (contents) { + socket.addEventListener('message', function (event) { expect(window.zone.parent).toBe(parent); - expect(contents.data).toBe('hi'); + expect(event.data).toBe('hi'); done(); }); socket.send('hi'); @@ -46,9 +46,8 @@ describe('WebSocket', function () { socket.send('hi'); }); - // TODO(vicb) this test is not working - // https://github.com/angular/zone.js/issues/81 - xit('should work with onmessage', function (done) { + + it('should work with onmessage', function (done) { var parent = window.zone; socket.onmessage = function (contents) { expect(window.zone.parent).toBe(parent); diff --git a/zone.js b/zone.js index 30618eb8b..9e643d2e3 100644 --- a/zone.js +++ b/zone.js @@ -452,6 +452,7 @@ Zone.canPatchViaPropertyDescriptor = function () { Zone.patchViaPropertyDescriptor = function () { Zone.patchProperties(HTMLElement.prototype, Zone.onEventNames); Zone.patchProperties(XMLHttpRequest.prototype); + Zone.patchProperties(WebSocket.prototype); }; // Whenever any event fires, we check the event target and all parents