< Summary

Information
Class: Pomodoro.Web.Components.TimerControlsBase
Assembly: Pomodoro.Web
File(s): /home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/TimerControls.razor.cs
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 84
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_IsRunning()100%11100%
get_IsPaused()100%11100%
get_IsStarted()100%11100%
get_CanStart()100%11100%
get_SessionType()100%11100%
get_OnStart()100%11100%
get_OnPause()100%11100%
get_OnResume()100%11100%
get_OnReset()100%11100%
get_IsStartDisabled()100%11100%
GetSessionLabel()100%44100%
GetSessionClass()100%44100%

File(s)

/home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Components/TimerControls.razor.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Components;
 2using Pomodoro.Web.Models;
 3
 4namespace Pomodoro.Web.Components;
 5
 6/// <summary>
 7/// Code-behind for TimerControls component
 8/// Separates business logic from view
 9/// </summary>
 10public class TimerControlsBase : ComponentBase
 11{
 12    #region Parameters (Model)
 13
 14    [Parameter]
 70715    public bool IsRunning { get; set; }
 16
 17    [Parameter]
 32718    public bool IsPaused { get; set; }
 19
 20    [Parameter]
 69821    public bool IsStarted { get; set; }
 22
 23    [Parameter]
 169624    public bool CanStart { get; set; }
 25
 26    [Parameter]
 70327    public SessionType SessionType { get; set; }
 28
 29    [Parameter]
 66230    public EventCallback OnStart { get; set; }
 31
 32    [Parameter]
 33533    public EventCallback OnPause { get; set; }
 34
 35    [Parameter]
 33536    public EventCallback OnResume { get; set; }
 37
 38    [Parameter]
 34539    public EventCallback OnReset { get; set; }
 40
 41    #endregion
 42
 43    #region Computed Properties
 44
 45    /// <summary>
 46    /// Determines if the Start button should be disabled
 47    /// </summary>
 134448    protected bool IsStartDisabled => !CanStart;
 49
 50    #endregion
 51
 52    #region Business Logic Methods
 53
 54    /// <summary>
 55    /// Gets the display label for the current session type
 56    /// </summary>
 57    protected string GetSessionLabel()
 458    {
 459        return SessionType switch
 460        {
 161            SessionType.Pomodoro => Constants.SessionTypes.PomodoroDisplayName,
 162            SessionType.ShortBreak => Constants.SessionTypes.ShortBreakDisplayName,
 163            SessionType.LongBreak => Constants.SessionTypes.LongBreakDisplayName,
 164            _ => string.Empty
 465        };
 466    }
 67
 68    /// <summary>
 69    /// Gets the CSS class for buttons based on current session type
 70    /// Matches PIP window behavior for consistent styling
 71    /// </summary>
 72    protected string GetSessionClass()
 34673    {
 34674        return SessionType switch
 34675        {
 33576            SessionType.Pomodoro => Constants.SessionTypes.PomodoroClass,
 577            SessionType.ShortBreak => Constants.SessionTypes.ShortBreakClass,
 378            SessionType.LongBreak => Constants.SessionTypes.LongBreakClass,
 379            _ => Constants.SessionTypes.PomodoroClass
 34680        };
 34681    }
 82
 83    #endregion
 84}