< Summary

Class:DCL.Social.Chat.ChannelContextualMenu
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelContextualMenu.cs
Covered lines:20
Uncovered lines:4
Coverable lines:24
Total lines:72
Line coverage:83.3% (20 of 24)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:5
Method coverage:100% (5 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Show(...)0%110100%
Hide(...)0%110100%
RefreshControl()0%110100%
SetHeaderTitle(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelContextualMenu.cs

#LineLine coverage
 1using System;
 2using TMPro;
 3using UIComponents.ContextMenu;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7namespace DCL.Social.Chat
 8{
 9    public class ChannelContextualMenu : ContextMenuComponentView
 10    {
 11        [Flags]
 12        internal enum Options
 13        {
 14            Leave = 1 << 0
 15        }
 16
 17        [SerializeField] internal Options options;
 18        [SerializeField] internal TMP_Text headerTiler;
 19        [SerializeField] internal Button leaveButton;
 20        [SerializeField] internal Button closeButton;
 21        [SerializeField] internal Button copyNameButton;
 22        [SerializeField] internal ShowHideAnimator nameCopiedToast;
 23
 24        public event Action OnLeave;
 25        public event Action<string> OnNameCopied;
 26
 27        public override void Awake()
 28        {
 629            base.Awake();
 30
 631            leaveButton.onClick.AddListener(() =>
 32            {
 333                OnLeave?.Invoke();
 334                Hide();
 335            });
 36
 737            closeButton.onClick.AddListener(() => Hide());
 638            copyNameButton.onClick.AddListener(() =>
 39            {
 040                OnNameCopied?.Invoke(headerTiler.text);
 41
 042                nameCopiedToast.gameObject.SetActive(true);
 043                nameCopiedToast.ShowDelayHide(3);
 044            });
 45
 646            RefreshControl();
 647        }
 48
 49        public override void Show(bool instant = false)
 50        {
 251            base.Show(instant);
 252            gameObject.SetActive(true);
 253            ClampPositionToScreenBorders(transform.position);
 254        }
 55
 56        public override void Hide(bool instant = false)
 57        {
 458            base.Hide(instant);
 459            gameObject.SetActive(false);
 460        }
 61
 62        public override void RefreshControl()
 63        {
 664            leaveButton.gameObject.SetActive((options & Options.Leave) != 0);
 665        }
 66
 67        public void SetHeaderTitle(string title)
 68        {
 469            headerTiler.text = title;
 470        }
 71    }
 72}