Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(WebSocket patch): fix WebSocket constants copy (#299)
Browse files Browse the repository at this point in the history
fix(WebSocket patch): fix WebSocket constants copy (#299)
  • Loading branch information
mtsmfm authored and mhevery committed Apr 8, 2016
1 parent 55da3d8 commit 5dc4339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/browser/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function apply(_global: any) {

return proxySocket;
};
(<any>global).WebSocket.prototype = Object.create(WS.prototype, {constructor:{value: WebSocket}});
for (var prop in WS) { _global.WebSocket[prop] = WS[prop]; }
}
7 changes: 7 additions & 0 deletions test/browser/WebSocket.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,12 @@ if (!window['soucelabs']) {
done();
}, 100);
}, TIMEOUT);

it('should have constants', function () {
expect(Object.keys(WebSocket)).toContain('CONNECTING');
expect(Object.keys(WebSocket)).toContain('OPEN');
expect(Object.keys(WebSocket)).toContain('CLOSING');
expect(Object.keys(WebSocket)).toContain('CLOSED');
});
}));
}

0 comments on commit 5dc4339

Please sign in to comment.