소스 검색

Work on fixing the tests

master
Ilya Daynatovich 8 년 전
부모
커밋
fb4e9b3c6d
6개의 변경된 파일115개의 추가작업 그리고 61개의 파일을 삭제
  1. 4
    0
      css/_base.scss
  2. 3
    31
      modules/UI/feedback/Feedback.js
  3. 17
    3
      modules/UI/recording/Recording.js
  4. 9
    2
      modules/UI/side_pannels/chat/Chat.js
  5. 50
    22
      modules/UI/toolbars/Toolbar.js
  6. 32
    3
      modules/UI/util/UIUtil.js

+ 4
- 0
css/_base.scss 파일 보기

153
     display: inline-block !important;
153
     display: inline-block !important;
154
 }
154
 }
155
 
155
 
156
+.show-list-item {
157
+    display: list-item !important;
158
+}
159
+
156
 /**
160
 /**
157
  * Shows a flex element.
161
  * Shows a flex element.
158
  */
162
  */

+ 3
- 31
modules/UI/feedback/Feedback.js 파일 보기

1
 /* global $, APP, JitsiMeetJS */
1
 /* global $, APP, JitsiMeetJS */
2
-import UIEvents from "../../../service/UI/UIEvents";
3
 import FeedbackWindow from "./FeedbackWindow";
2
 import FeedbackWindow from "./FeedbackWindow";
4
 
3
 
5
-/**
6
- * Shows / hides the feedback button.
7
- * @private
8
- */
9
-function _toggleFeedbackIcon() {
10
-    document.querySelector('#feedbackButton').classList.toggle('hidden');
11
-}
12
-
13
-/**
14
- * Shows / hides the feedback button.
15
- * @param {show} set to {true} to show the feedback button or to  {false}
16
- * to hide it
17
- * @private
18
- */
19
-function _showFeedbackButton (show) {
20
-    document.querySelector('#feedbackButton').classList.toggle('hide', !show);
21
-}
22
-
23
 /**
4
 /**
24
  * Defines all methods in connection to the Feedback window.
5
  * Defines all methods in connection to the Feedback window.
25
  *
6
  *
26
  * @type {{openFeedbackWindow: Function}}
7
  * @type {{openFeedbackWindow: Function}}
27
  */
8
  */
28
-var Feedback = {
9
+const Feedback = {
29
 
10
 
30
     /**
11
     /**
31
      * Initialise the Feedback functionality.
12
      * Initialise the Feedback functionality.
42
         if (typeof this.enabled == "undefined")
23
         if (typeof this.enabled == "undefined")
43
             this.enabled = true;
24
             this.enabled = true;
44
 
25
 
45
-        _showFeedbackButton(this.enabled);
46
-
47
         this.window = new FeedbackWindow();
26
         this.window = new FeedbackWindow();
27
+        this.emitter = emitter;
48
 
28
 
49
         $("#feedbackButton").click(Feedback.openFeedbackWindow);
29
         $("#feedbackButton").click(Feedback.openFeedbackWindow);
50
-
51
-        // Show / hide the feedback button whenever the film strip is
52
-        // shown / hidden.
53
-        emitter.addListener(UIEvents.TOGGLE_FILM_STRIP, function () {
54
-            _toggleFeedbackIcon();
55
-        });
56
     },
30
     },
57
     /**
31
     /**
58
      * Enables/ disabled the feedback feature.
32
      * Enables/ disabled the feedback feature.
59
      */
33
      */
60
     enableFeedback: function (enable) {
34
     enableFeedback: function (enable) {
61
-        if (this.enabled !== enable)
62
-            _showFeedbackButton(enable);
63
         this.enabled = enable;
35
         this.enabled = enable;
64
     },
36
     },
65
 
37
 
120
     }
92
     }
121
 };
93
 };
122
 
94
 
123
-module.exports = Feedback;
95
+export default Feedback;

+ 17
- 3
modules/UI/recording/Recording.js 파일 보기

387
      * @param show {true} to show the recording button, {false} to hide it
387
      * @param show {true} to show the recording button, {false} to hide it
388
      */
388
      */
389
     showRecordingButton (show) {
389
     showRecordingButton (show) {
390
-        var visibility = show && _isRecordingButtonEnabled();
391
-        document.querySelector('#toolbar_button_record')
392
-                .classList.toggle('hide', !visibility);
390
+        let isVisible = show && _isRecordingButtonEnabled();
391
+        let id = 'toolbar_button_record';
392
+
393
+        console.log('recording is visible', isVisible);
394
+
395
+        if (isVisible) {
396
+            UIUtil.showElement(id);
397
+        } else {
398
+            UIUtil.hideElement(id);
399
+        }
393
     },
400
     },
394
 
401
 
395
     /**
402
     /**
472
             labelSelector.css({display: "inline-block"});
479
             labelSelector.css({display: "inline-block"});
473
 
480
 
474
         // Recording spinner
481
         // Recording spinner
482
+        let spinnerId = 'recordingSpinner';
483
+        if(recordingState === Status.RETRYING) {
484
+            UIUtil.showElement(spinnerId);
485
+        } else {
486
+            UIUtil.hideElement(spinnerId);
487
+        }
488
+
475
         document.querySelector('#recordingSpinner').classList
489
         document.querySelector('#recordingSpinner').classList
476
                 .toggle('show-inline', recordingState === Status.RETRYING);
490
                 .toggle('show-inline', recordingState === Status.RETRYING);
477
     },
491
     },

+ 9
- 2
modules/UI/side_pannels/chat/Chat.js 파일 보기

293
      * @param subject the subject
293
      * @param subject the subject
294
      */
294
      */
295
     setSubject (subject) {
295
     setSubject (subject) {
296
+        let toggleFunction;
296
         if (subject) {
297
         if (subject) {
297
             subject = subject.trim();
298
             subject = subject.trim();
299
+            toggleFunction = UIUtil.showElement.bind(UIUtil);
300
+        } else {
301
+            toggleFunction = UIUtil.hideElement.bind(UIUtil);
298
         }
302
         }
299
-        $('#subject').html(linkify(UIUtil.escapeHtml(subject)));
300
-        document.querySelector('#subject').classList.toggle('hide', !subject);
303
+
304
+        let subjectId = 'subject';
305
+        let html = linkify(UIUtil.escapeHtml(subject));
306
+        $(`#${subjectId}`).html(html);
307
+        toggleFunction(subjectId);
301
     },
308
     },
302
 
309
 
303
     /**
310
     /**

+ 50
- 22
modules/UI/toolbars/Toolbar.js 파일 보기

417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
418
      */
418
      */
419
     showAuthenticateButton (show) {
419
     showAuthenticateButton (show) {
420
-        document.querySelector('#authenticationContainer')
421
-                .classList.toggle('hide', !show);
420
+        let id = 'authenticationContainer';
421
+        if (show) {
422
+            UIUtil.showElement(id);
423
+        } else {
424
+            UIUtil.hideElement(id);
425
+        }
422
     },
426
     },
423
 
427
 
424
     showEtherpadButton () {
428
     showEtherpadButton () {
429
 
433
 
430
     // Shows or hides the 'shared video' button.
434
     // Shows or hides the 'shared video' button.
431
     showSharedVideoButton () {
435
     showSharedVideoButton () {
432
-        if (!UIUtil.isButtonEnabled('sharedvideo')) {
433
-            return;
436
+        let id = 'toolbar_button_sharedvideo';
437
+        let shouldShow = UIUtil.isButtonEnabled('sharedvideo')
438
+                && !config.disableThirdPartyRequests;
439
+
440
+        if (shouldShow) {
441
+            let el = document.getElementById(id);
442
+            UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
443
+            UIUtil.showElement(id);
444
+        } else {
445
+            UIUtil.hideElement(id);
434
         }
446
         }
435
-        var el = document.querySelector('#toolbar_button_sharedvideo');
436
-        UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
437
-        el.classList.toggle('hide', config.disableThirdPartyRequests === true);
438
     },
447
     },
439
 
448
 
440
     // checks whether desktop sharing is enabled and whether
449
     // checks whether desktop sharing is enabled and whether
448
 
457
 
449
     // Shows or hides SIP calls button
458
     // Shows or hides SIP calls button
450
     showSipCallButton (show) {
459
     showSipCallButton (show) {
451
-        if (!UIUtil.isButtonEnabled('sip')) {
452
-            return;
460
+        let shouldShow = APP.conference.sipGatewayEnabled()
461
+            && UIUtil.isButtonEnabled('sip') && show;
462
+        let id = 'toolbar_button_sip';
463
+
464
+        if (shouldShow) {
465
+            UIUtil.showElement(id);
466
+        } else {
467
+            UIUtil.hideElement(id);
453
         }
468
         }
454
-        document.querySelector('#toolbar_button_sip').classList
455
-                .toggle('hide', !(show && APP.conference.sipGatewayEnabled()));
456
     },
469
     },
457
 
470
 
458
     // Shows or hides the dialpad button
471
     // Shows or hides the dialpad button
459
     showDialPadButton (show) {
472
     showDialPadButton (show) {
460
-        if (!UIUtil.isButtonEnabled('dialpad')) {
461
-            return;
473
+        let shouldShow = UIUtil.isButtonEnabled('dialpad') && show;
474
+        let id = 'toolbar_button_dialpad';
475
+        if (shouldShow) {
476
+            UIUtil.showElement(id);
477
+        } else {
478
+            UIUtil.hideElement(id);
462
         }
479
         }
463
-        document.querySelector('#toolbar_button_dialpad')
464
-                .classList.toggle('hide', !show);
465
     },
480
     },
466
 
481
 
467
     /**
482
     /**
469
      * @param authIdentity identity name to be displayed.
484
      * @param authIdentity identity name to be displayed.
470
      */
485
      */
471
     setAuthenticatedIdentity (authIdentity) {
486
     setAuthenticatedIdentity (authIdentity) {
472
-        let selector = $('#toolbar_auth_identity');
473
-        selector.text(authIdentity ? authIdentity : '');
474
-        selector.get(0).classList.toggle('hide', !authIdentity);
487
+        let id = 'toolbar_auth_identity';
488
+        if(authIdentity) {
489
+            UIUtil.showElement(id);
490
+            $(`#${id}`).text(authIdentity);
491
+        } else {
492
+            UIUtil.hideElement(id);
493
+            $(`#${id}`).text('');
494
+        }
475
     },
495
     },
476
 
496
 
477
     /**
497
     /**
479
      * @param show <tt>true</tt> to show
499
      * @param show <tt>true</tt> to show
480
      */
500
      */
481
     showLoginButton (show) {
501
     showLoginButton (show) {
482
-        document.querySelector('#toolbar_button_login')
483
-                .classList.toggle('hide', !show);
502
+        let id = 'toolbar_button_login';
503
+        if (show) {
504
+            UIUtil.showElement(id);
505
+        } else {
506
+            UIUtil.hideElement(id);
507
+        }
484
     },
508
     },
485
 
509
 
486
     /**
510
     /**
488
      * @param show <tt>true</tt> to show
512
      * @param show <tt>true</tt> to show
489
      */
513
      */
490
     showLogoutButton (show) {
514
     showLogoutButton (show) {
491
-        document.querySelector('#toolbar_button_logout')
492
-                .classList.toggle('hide', !show);
515
+        let id = 'toolbar_button_logout';
516
+        if (show) {
517
+            UIUtil.showElement(id);
518
+        } else {
519
+            UIUtil.hideElement(id);
520
+        }
493
     },
521
     },
494
 
522
 
495
     /**
523
     /**

+ 32
- 3
modules/UI/util/UIUtil.js 파일 보기

18
     'top-right': 'sw'
18
     'top-right': 'sw'
19
 };
19
 };
20
 
20
 
21
+/**
22
+ * Associates the default display type with corresponding CSS class
23
+ */
24
+const SHOW_CLASSES = {
25
+    'block': 'show',
26
+    'inline': 'show-inline',
27
+    'list-item': 'show-list-item'
28
+};
29
+
21
 /**
30
 /**
22
  * Created by hristo on 12/22/14.
31
  * Created by hristo on 12/22/14.
23
  */
32
  */
229
             element.classList.remove('hide');
238
             element.classList.remove('hide');
230
         }
239
         }
231
 
240
 
232
-        element.classList.add('show');
241
+        let type = this.getElementDefaultDisplay(element.tagName);
242
+        let className = SHOW_CLASSES[type];
243
+        element.classList.add(className);
233
     },
244
     },
234
 
245
 
235
     /**
246
     /**
244
             return;
255
             return;
245
         }
256
         }
246
 
257
 
247
-        if(element.classList.contains('show')) {
248
-            element.classList.remove('show');
258
+        let type = this.getElementDefaultDisplay(element.tagName);
259
+        let className = SHOW_CLASSES[type];
260
+
261
+        if(element.classList.contains(className)) {
262
+            element.classList.remove(className);
249
         }
263
         }
250
 
264
 
251
         element.classList.add('hide');
265
         element.classList.add('hide');
252
     },
266
     },
253
 
267
 
268
+    /**
269
+     * Returns default display style for the tag
270
+     * @param tag
271
+     * @returns {*}
272
+     */
273
+    getElementDefaultDisplay(tag) {
274
+        let tempElement = document.createElement(tag);
275
+
276
+        document.body.appendChild(tempElement);
277
+        let style = window.getComputedStyle(tempElement).display;
278
+        document.body.removeChild(tempElement);
279
+
280
+        return style;
281
+    },
282
+
254
     /**
283
     /**
255
      * Shows / hides the element with the given jQuery selector.
284
      * Shows / hides the element with the given jQuery selector.
256
      *
285
      *

Loading…
취소
저장