File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- lib-cov
2- * .seed
3- * .log
4- * .csv
5- * .dat
6- * .out
7- * .pid
8- * .gz
9-
10- pids
11- logs
12- results
13-
14- npm-debug.log
15- node_modules
1+ .idea
2+ /bower_components
Original file line number Diff line number Diff line change 1+ {
2+ "indent" : 2 ,
3+ "maxlen" : 120 ,
4+ "asi" : true ,
5+ "quotmark" : " double" ,
6+ "laxcomma" : true ,
7+ "smarttabs" : true ,
8+ "trailing" : true ,
9+ "strict" : false ,
10+ "boss" : false ,
11+ "white" : false ,
12+ "newcap" : true ,
13+ "noarg" : true ,
14+ "nonew" : true ,
15+ "browser" : true ,
16+ "jquery" : true ,
17+ "mootools" : true ,
18+ "node" : true ,
19+ "devel" : true ,
20+ "undef" : true ,
21+ "unused" : true ,
22+ "latedef" : true ,
23+ "onecase" : true ,
24+ "globals" : {
25+ "describe" : false ,
26+ "it" : false ,
27+ "before" : false ,
28+ "beforeEach" : false ,
29+ "after" : false ,
30+ "afterEach" : false ,
31+ "module" : false ,
32+ "inject" : false ,
33+ "define" : false
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ define ( [ "bower_components/angular/angular" ] , function ( angular ) {
2+ var ng = angular . module ( "btford.socket-io" , [ ] )
3+ ng . provider ( "socket" , function ( ) {
4+ this . $get = function ( $rootScope ) {
5+
6+ var obj = { }
7+ obj . events = { }
8+ obj . emits = { }
9+
10+ // intercept 'on' calls and capture the callbacks
11+ obj . on = function ( eventName , callback ) {
12+ if ( ! this . events [ eventName ] ) this . events [ eventName ] = [ ]
13+ this . events [ eventName ] . push ( callback )
14+ }
15+
16+ // intercept 'emit' calls from the client and record them to assert against in the test
17+ obj . emit = function ( eventName ) {
18+ var args = Array . prototype . slice . call ( arguments , 1 )
19+
20+ if ( ! this . emits [ eventName ] )
21+ this . emits [ eventName ] = [ ]
22+ this . emits [ eventName ] . push ( args )
23+ }
24+
25+ //simulate an inbound message to the socket from the server (only called from the test)
26+ obj . receive = function ( eventName ) {
27+ var args = Array . prototype . slice . call ( arguments , 1 )
28+
29+ if ( this . events [ eventName ] ) {
30+ angular . forEach ( this . events [ eventName ] , function ( callback ) {
31+ $rootScope . $apply ( function ( ) {
32+ callback . apply ( this , args )
33+ } )
34+ } )
35+ }
36+ }
37+ return obj
38+ }
39+ } )
40+ } )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " angular-socket.io-mock" ,
3+ "version" : " 0.0.1" ,
4+ "dependencies" : {
5+ "angular" : " latest" ,
6+ "angular-socket-io" : " latest" ,
7+ "requirejs" : " latest"
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments