< Summary

Class:DCL.Builder.NewProjectFirstStepView
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/NewProject/NewProjectFirstStepView.cs
Covered lines:27
Uncovered lines:2
Coverable lines:29
Total lines:72
Line coverage:93.1% (27 of 29)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
RefreshControl()0%2100%
Dispose()0%110100%
NextPressed()0%3.043083.33%
BackPressed()0%220100%
EnableNextButton()0%110100%
DisableNextButton()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/NewProject/NewProjectFirstStepView.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using TMPro;
 5using UnityEngine;
 6
 7namespace DCL.Builder
 8{
 9    public class NewProjectFirstStepView : BaseComponentView
 10    {
 11        public event Action OnBackPressed;
 12        public event Action<string, string> OnNextPressed;
 13
 14        [SerializeField] internal LimitInputField titleInputField;
 15        [SerializeField] private LimitInputField descriptionInputField;
 16
 17        [SerializeField] internal ButtonComponentView nextButton;
 18        [SerializeField] private ButtonComponentView backButton;
 19
 20        // Start is called before the first frame update
 21        public override void Awake()
 22        {
 823            base.Awake();
 24
 825            titleInputField.OnLimitReached += DisableNextButton;
 826            titleInputField.OnEmptyValue += DisableNextButton;
 827            titleInputField.OnInputAvailable += EnableNextButton;
 28
 829            descriptionInputField.OnLimitReached += DisableNextButton;
 830            descriptionInputField.OnInputAvailable += EnableNextButton;
 31
 832            backButton.onClick.AddListener(BackPressed);
 833            nextButton.onClick.AddListener(NextPressed);
 34
 835            DisableNextButton();
 836        }
 37
 038        public override void RefreshControl() { }
 39
 40        public override void Dispose()
 41        {
 842            base.Dispose();
 843            titleInputField.OnLimitReached -= DisableNextButton;
 844            titleInputField.OnEmptyValue -= DisableNextButton;
 845            titleInputField.OnInputAvailable -= EnableNextButton;
 46
 847            descriptionInputField.OnLimitReached -= DisableNextButton;
 848            descriptionInputField.OnInputAvailable -= EnableNextButton;
 49
 850            backButton.onClick.RemoveListener(BackPressed);
 851            nextButton.onClick.RemoveListener(NextPressed);
 852        }
 53
 54        internal void NextPressed()
 55        {
 156            if (!nextButton.IsInteractable())
 057                return;
 58
 159            string title = titleInputField.GetValue();
 160            string description = descriptionInputField.GetValue();
 61
 162            OnNextPressed?.Invoke(title, description);
 163        }
 64
 265        internal void BackPressed() { OnBackPressed?.Invoke(); }
 66
 667        internal void EnableNextButton() { nextButton.SetInteractable(true); }
 68
 2269        internal void DisableNextButton() { nextButton.SetInteractable(false); }
 70
 71    }
 72}