Browse Source

[eslint] no-spaced-func

dev1
Lyubo Marinov 8 years ago
parent
commit
a2f62d9c28
5 changed files with 23 additions and 22 deletions
  1. 1
    0
      .eslintrc.js
  2. 1
    1
      JitsiConference.js
  3. 2
    2
      modules/RTC/ScreenObtainer.js
  4. 1
    1
      modules/xmpp/Caps.js
  5. 18
    18
      modules/xmpp/RtxModifier.spec.js

+ 1
- 0
.eslintrc.js View File

147
         'no-new-object': 2,
147
         'no-new-object': 2,
148
         'no-plusplus': 0,
148
         'no-plusplus': 0,
149
         'no-restricted-syntax': 0,
149
         'no-restricted-syntax': 0,
150
+        'no-spaced-func': 2,
150
         'no-tabs': 2,
151
         'no-tabs': 2,
151
         'no-ternary': 0,
152
         'no-ternary': 0,
152
         'no-trailing-spaces': 2,
153
         'no-trailing-spaces': 2,

+ 1
- 1
JitsiConference.js View File

510
  * @returns {Promise}
510
  * @returns {Promise}
511
  */
511
  */
512
 JitsiConference.prototype.removeTrack = function(track) {
512
 JitsiConference.prototype.removeTrack = function(track) {
513
-    return this.replaceTrack (track, null);
513
+    return this.replaceTrack(track, null);
514
 };
514
 };
515
 
515
 
516
 /**
516
 /**

+ 2
- 2
modules/RTC/ScreenObtainer.js View File

79
 
79
 
80
         if (RTCBrowserType.isNWJS()) {
80
         if (RTCBrowserType.isNWJS()) {
81
             obtainDesktopStream = (options, onSuccess, onFailure) => {
81
             obtainDesktopStream = (options, onSuccess, onFailure) => {
82
-                window.JitsiMeetNW.obtainDesktopStream (
82
+                window.JitsiMeetNW.obtainDesktopStream(
83
                     onSuccess,
83
                     onSuccess,
84
                     (error, constraints) => {
84
                     (error, constraints) => {
85
                         var jitsiError;
85
                         var jitsiError;
112
             };
112
             };
113
         } else if(RTCBrowserType.isElectron()) {
113
         } else if(RTCBrowserType.isElectron()) {
114
             obtainDesktopStream = (options, onSuccess, onFailure) =>
114
             obtainDesktopStream = (options, onSuccess, onFailure) =>
115
-                window.JitsiMeetElectron.obtainDesktopStream (
115
+                window.JitsiMeetElectron.obtainDesktopStream(
116
                     streamId =>
116
                     streamId =>
117
                         onGetStreamResponse({streamId}, onSuccess, onFailure),
117
                         onGetStreamResponse({streamId}, onSuccess, onFailure),
118
                     err => onFailure(new JitsiTrackError(
118
                     err => onFailure(new JitsiTrackError(

+ 1
- 1
modules/xmpp/Caps.js View File

106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
107
         if(!user || !(user.version in this.versionToCapabilities)) {
107
         if(!user || !(user.version in this.versionToCapabilities)) {
108
             const node = user ? user.node + '#' + user.version : null;
108
             const node = user ? user.node + '#' + user.version : null;
109
-            return new Promise ((resolve, reject) =>
109
+            return new Promise((resolve, reject) =>
110
                 this.disco.info(jid, node, response => {
110
                 this.disco.info(jid, node, response => {
111
                     const features = new Set();
111
                     const features = new Set();
112
                     $(response).find('>query>feature').each((idx, el) =>
112
                     $(response).find('>query>feature').each((idx, el) =>

+ 18
- 18
modules/xmpp/RtxModifier.spec.js View File

66
     .filter(g => g.semantics === groupSemantics);
66
     .filter(g => g.semantics === groupSemantics);
67
 }
67
 }
68
 
68
 
69
-describe ('RtxModifier', function() {
69
+describe('RtxModifier', function() {
70
     beforeEach(function() {
70
     beforeEach(function() {
71
         this.rtxModifier = new RtxModifier();
71
         this.rtxModifier = new RtxModifier();
72
         this.transform = transform;
72
         this.transform = transform;
73
         this.SDPUtil = SDPUtil;
73
         this.SDPUtil = SDPUtil;
74
     });
74
     });
75
 
75
 
76
-    describe ('modifyRtxSsrcs', function() {
77
-        describe ('when given an sdp with a single video ssrc', function() {
76
+    describe('modifyRtxSsrcs', function() {
77
+        describe('when given an sdp with a single video ssrc', function() {
78
             beforeEach(function() {
78
             beforeEach(function() {
79
                 this.singleVideoSdp = SampleSdpStrings.plainVideoSdp;
79
                 this.singleVideoSdp = SampleSdpStrings.plainVideoSdp;
80
                 this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
80
                 this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
81
             });
81
             });
82
-            it ('should add a single rtx ssrc', function() {
82
+            it('should add a single rtx ssrc', function() {
83
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
83
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
84
           //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
84
           //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
85
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
85
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
97
                 expect(fidGroupPrimarySsrc).toEqual(this.primaryVideoSsrc);
97
                 expect(fidGroupPrimarySsrc).toEqual(this.primaryVideoSsrc);
98
             });
98
             });
99
 
99
 
100
-            it ('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
100
+            it('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
101
           // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
101
           // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
102
           //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
102
           //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
103
           //  the same rtx ssrc as before.
103
           //  the same rtx ssrc as before.
115
                 expect(newFidGroupRtxSsrc).toEqual(fidGroupRtxSsrc);
115
                 expect(newFidGroupRtxSsrc).toEqual(fidGroupRtxSsrc);
116
             });
116
             });
117
 
117
 
118
-            it ('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
118
+            it('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
119
           // Call modifyRtxSsrcs to generate an rtx ssrc
119
           // Call modifyRtxSsrcs to generate an rtx ssrc
120
           // Clear the rtxModifier cache
120
           // Clear the rtxModifier cache
121
           // Call modifyRtxSsrcs to generate an rtx ssrc again with the same primary ssrc
121
           // Call modifyRtxSsrcs to generate an rtx ssrc again with the same primary ssrc
135
                 expect(newFidGroupRtxSsrc).not.toEqual(fidGroupRtxSsrc);
135
                 expect(newFidGroupRtxSsrc).not.toEqual(fidGroupRtxSsrc);
136
             });
136
             });
137
 
137
 
138
-            it ('should use the rtx ssrc from the cache when the cache has been manually set', function() {
138
+            it('should use the rtx ssrc from the cache when the cache has been manually set', function() {
139
           // Manually set an rtx ssrc mapping in the cache
139
           // Manually set an rtx ssrc mapping in the cache
140
           // Call modifyRtxSsrcs
140
           // Call modifyRtxSsrcs
141
           // -->The rtx ssrc used should be the one we set
141
           // -->The rtx ssrc used should be the one we set
152
             });
152
             });
153
         });
153
         });
154
 
154
 
155
-        describe ('when given an sdp with multiple video ssrcs', function() {
155
+        describe('when given an sdp with multiple video ssrcs', function() {
156
             beforeEach(function() {
156
             beforeEach(function() {
157
                 this.multipleVideoSdp = SampleSdpStrings.simulcastSdp;
157
                 this.multipleVideoSdp = SampleSdpStrings.simulcastSdp;
158
                 this.primaryVideoSsrcs = getPrimaryVideoSsrcs(this.multipleVideoSdp);
158
                 this.primaryVideoSsrcs = getPrimaryVideoSsrcs(this.multipleVideoSdp);
159
             });
159
             });
160
 
160
 
161
-            it ('should add rtx ssrcs for all of them', function() {
161
+            it('should add rtx ssrcs for all of them', function() {
162
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
162
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
163
           //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
163
           //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
164
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
164
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
176
                 });
176
                 });
177
             });
177
             });
178
 
178
 
179
-            it ('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
179
+            it('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
180
           // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
180
           // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
181
           //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
181
           //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
182
           //  the same rtx ssrc as before.
182
           //  the same rtx ssrc as before.
205
                 });
205
                 });
206
             });
206
             });
207
 
207
 
208
-            it ('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
208
+            it('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
209
           // Call modifyRtxSsrcs to generate an rtx ssrc
209
           // Call modifyRtxSsrcs to generate an rtx ssrc
210
           // Clear the rtxModifier cache
210
           // Clear the rtxModifier cache
211
           // Call modifyRtxSsrcs to generate rtx ssrcs again with the same primary ssrcs
211
           // Call modifyRtxSsrcs to generate rtx ssrcs again with the same primary ssrcs
237
                 });
237
                 });
238
             });
238
             });
239
 
239
 
240
-            it ('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
240
+            it('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
241
           // Manually set an rtx ssrc mapping in the cache
241
           // Manually set an rtx ssrc mapping in the cache
242
           // Call modifyRtxSsrcs
242
           // Call modifyRtxSsrcs
243
           // -->The rtx ssrc used should be the one we set
243
           // -->The rtx ssrc used should be the one we set
261
             });
261
             });
262
         });
262
         });
263
 
263
 
264
-        describe ('(corner cases)', function() {
265
-            it ('should handle a recvonly video mline', function() {
264
+        describe('(corner cases)', function() {
265
+            it('should handle a recvonly video mline', function() {
266
                 const sdp = SampleSdpStrings.plainVideoSdp;
266
                 const sdp = SampleSdpStrings.plainVideoSdp;
267
                 const videoMLine = sdp.media.find(m => m.type === 'video');
267
                 const videoMLine = sdp.media.find(m => m.type === 'video');
268
                 videoMLine.direction = 'recvonly';
268
                 videoMLine.direction = 'recvonly';
270
                 expect(newSdpStr).toEqual(this.transform.write(sdp));
270
                 expect(newSdpStr).toEqual(this.transform.write(sdp));
271
             });
271
             });
272
 
272
 
273
-            it ('should handle an inactive video mline', function() {
273
+            it('should handle an inactive video mline', function() {
274
                 const sdp = SampleSdpStrings.plainVideoSdp;
274
                 const sdp = SampleSdpStrings.plainVideoSdp;
275
                 const videoMLine = sdp.media.find(m => m.type === 'video');
275
                 const videoMLine = sdp.media.find(m => m.type === 'video');
276
                 videoMLine.direction = 'inactive';
276
                 videoMLine.direction = 'inactive';
278
                 expect(newSdpStr).toEqual(this.transform.write(sdp));
278
                 expect(newSdpStr).toEqual(this.transform.write(sdp));
279
             });
279
             });
280
 
280
 
281
-            it ('should handle a video mline with no video ssrcs', function() {
281
+            it('should handle a video mline with no video ssrcs', function() {
282
                 const sdp = SampleSdpStrings.plainVideoSdp;
282
                 const sdp = SampleSdpStrings.plainVideoSdp;
283
                 const videoMLine = sdp.media.find(m => m.type === 'video');
283
                 const videoMLine = sdp.media.find(m => m.type === 'video');
284
                 videoMLine.ssrcs = [];
284
                 videoMLine.ssrcs = [];
291
     describe('stripRtx', function() {
291
     describe('stripRtx', function() {
292
         beforeEach(function() {
292
         beforeEach(function() {
293
         });
293
         });
294
-        it ('should strip all rtx streams from an sdp with rtx', function() {
294
+        it('should strip all rtx streams from an sdp with rtx', function() {
295
             const sdpStr = transform.write(SampleSdpStrings.rtxVideoSdp);
295
             const sdpStr = transform.write(SampleSdpStrings.rtxVideoSdp);
296
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
296
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
297
             const newSdp = transform.parse(newSdpStr);
297
             const newSdp = transform.parse(newSdpStr);
299
             expect(fidGroups.length).toEqual(0);
299
             expect(fidGroups.length).toEqual(0);
300
             expect(numVideoSsrcs(newSdp)).toEqual(1);
300
             expect(numVideoSsrcs(newSdp)).toEqual(1);
301
         });
301
         });
302
-        it ('should do nothing to an sdp with no rtx', function() {
302
+        it('should do nothing to an sdp with no rtx', function() {
303
             const sdpStr = transform.write(SampleSdpStrings.plainVideoSdp);
303
             const sdpStr = transform.write(SampleSdpStrings.plainVideoSdp);
304
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
304
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
305
             expect(newSdpStr).toEqual(sdpStr);
305
             expect(newSdpStr).toEqual(sdpStr);

Loading…
Cancel
Save