Skip to content

Commit

Permalink
add connect method
Browse files Browse the repository at this point in the history
to accomodate this pull request for socket.io socketio/socket.io-client#732
  • Loading branch information
Vadim Kazakov committed Dec 8, 2014
1 parent f4ded22 commit 6cdbe2d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mock/socket-io.js
Expand Up @@ -41,7 +41,8 @@ function createMockSocketObject () {
this._listeners = {};
}
},
disconnect: function () {}
disconnect: function () {},
connect: function () {}
};

return socket;
Expand Down
4 changes: 4 additions & 0 deletions socket.js
Expand Up @@ -70,6 +70,10 @@ angular.module('btford.socket-io', []).
return socket.disconnect(close);
},

connect: function() {
return socket.connect();
},

// when socket.on('someEvent', fn (data) { ... }),
// call scope.$broadcast('someEvent', data)
forward: function (events, scope) {
Expand Down
3 changes: 2 additions & 1 deletion socket.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion socket.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions socket.spec.js
Expand Up @@ -57,6 +57,16 @@ describe('socketFactory', function () {

});

describe('#connect', function () {

it('should call the underlying socket.connect', function () {
mockIoSocket.connect = spy;
socket.connect();
expect(spy).toHaveBeenCalled();
});

});


describe('#once', function () {

Expand Down

0 comments on commit 6cdbe2d

Please sign in to comment.