< Summary

Class:BIWSearchBarView
Assembly:BuildModeHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/Common/BIWSearchBarView.cs
Covered lines:11
Uncovered lines:2
Coverable lines:13
Total lines:47
Line coverage:84.6% (11 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%220100%
OnDestroy()0%110100%
SetSmartItemPressStatus(...)0%12300%
SetEmptyFilter()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/BuildModeHUD/Scripts/Common/BIWSearchBarView.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5public interface IBIWSearchBarView
 6{
 7    TMP_InputField searchInput { get; }
 8    Button smartItemBtn { get; }
 9    void SetSmartItemPressStatus(bool isPressed);
 10    void SetEmptyFilter();
 11}
 12
 13public class BIWSearchBarView : MonoBehaviour , IBIWSearchBarView
 14{
 215    public TMP_InputField searchInput => searchInputField;
 216    public Button smartItemBtn => smartItemButton;
 17
 18    public Color smartItemPressedBtnColor;
 19    public Color smartItemNormalBtnColor;
 20
 21    [Header("Prefab References")]
 22    [SerializeField] internal TMP_InputField searchInputField;
 23    [SerializeField] internal Button smartItemButton;
 24    [SerializeField] internal Button clearSearchButton;
 25
 26    private void Awake()
 27    {
 1528        if (searchInputField.placeholder != null)
 29        {
 1530            searchInput.onSelect.AddListener((x) => searchInputField.placeholder.gameObject.SetActive(false));
 1531            searchInput.onDeselect.AddListener((x) => searchInputField.placeholder.gameObject.SetActive(true));
 32        }
 33
 1534        clearSearchButton.onClick.AddListener(() => searchInputField.text = string.Empty);
 1535    }
 36
 37    private void OnDestroy()
 38    {
 1539        searchInput.onSelect.RemoveAllListeners();
 1540        searchInput.onDeselect.RemoveAllListeners();
 1541        clearSearchButton.onClick.RemoveAllListeners();
 1542    }
 43
 044    public void SetSmartItemPressStatus(bool isPressed) { smartItemBtn.image.color = isPressed ? smartItemPressedBtnColo
 45
 046    public void SetEmptyFilter() { searchInputField.text = ""; }
 47}