< Summary

Class:DCL.Social.Chat.ChatMentionSuggestionEntryComponentView
Assembly:ChatHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ChatWidgetHUD/ChatMentionSuggestionEntryComponentView.cs
Covered lines:10
Uncovered lines:7
Coverable lines:17
Total lines:65
Line coverage:58.8% (10 of 17)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:8
Method coverage:50% (4 of 8)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
RefreshControl()0%110100%
OnSelect(...)0%110100%
OnDeselect(...)0%2100%
OnSubmit(...)0%2100%
Deselect()0%2100%
Select()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ChatWidgetHUD/ChatMentionSuggestionEntryComponentView.cs

#LineLine coverage
 1using System;
 2using TMPro;
 3using UIComponents.Scripts.Components;
 4using UnityEngine;
 5using UnityEngine.EventSystems;
 6using UnityEngine.UI;
 7
 8namespace DCL.Social.Chat
 9{
 10    public class ChatMentionSuggestionEntryComponentView : BaseComponentView<ChatMentionSuggestionModel>,
 11        ISelectHandler, IDeselectHandler, ISubmitHandler
 12    {
 13        [SerializeField] internal Button selectButton;
 14        [SerializeField] internal TMP_Text userNameLabel;
 15        [SerializeField] internal ImageComponentView faceImage;
 16
 17        private bool isSelected;
 18
 19        public event Action<ChatMentionSuggestionModel> OnSubmitted;
 20
 21        public bool IsSelected
 22        {
 23            get
 24            {
 025                GameObject selectedGameObject = EventSystem.current.currentSelectedGameObject;
 026                return selectedGameObject == gameObject || selectedGameObject == selectButton.gameObject
 27                    || isSelected;
 28            }
 29        }
 30
 31        public override void Awake()
 32        {
 633            base.Awake();
 34
 735            selectButton.onClick.AddListener(() => OnSubmitted?.Invoke(model));
 636        }
 37
 38        public override void RefreshControl()
 39        {
 440            userNameLabel.text = model.userName;
 441            faceImage.SetImage(model.imageUrl);
 442        }
 43
 44        public void OnSelect(BaseEventData eventData)
 45        {
 246            selectButton.OnSelect(eventData);
 247            isSelected = true;
 248        }
 49
 50        public void OnDeselect(BaseEventData eventData)
 51        {
 052            selectButton.OnDeselect(eventData);
 053            isSelected = false;
 054        }
 55
 56        public void OnSubmit(BaseEventData eventData) =>
 057            selectButton.OnSubmit(eventData);
 58
 59        public void Deselect() =>
 060            OnDeselect(null);
 61
 62        public void Select() =>
 263            OnSelect(null);
 64    }
 65}