< Summary

Information
Class: Pomodoro.Web.Layout.MainLayoutBase
Assembly: Pomodoro.Web
File(s): /home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Layout/MainLayout.razor.cs
Line coverage
100%
Covered lines: 25
Uncovered lines: 0
Coverable lines: 25
Total lines: 46
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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_JSRuntime()100%11100%
get_NavigationManager()100%11100%
OnAfterRenderAsync()100%22100%
NavigateTo(...)100%11100%
Dispose()100%44100%

File(s)

/home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Layout/MainLayout.razor.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Components;
 2using Microsoft.JSInterop;
 3
 4namespace Pomodoro.Web.Layout;
 5
 6public partial class MainLayoutBase : LayoutComponentBase, IDisposable
 7{
 8    [Inject]
 3329    protected IJSRuntime JSRuntime { get; set; } = default!;
 10
 11    [Inject]
 16712    protected NavigationManager NavigationManager { get; set; } = default!;
 13
 14    private DotNetObjectReference<MainLayoutBase>? _dotNetRef;
 15    private bool _isDisposed;
 16
 17    protected override async Task OnAfterRenderAsync(bool firstRender)
 8718    {
 8719        if (firstRender)
 8320        {
 8321            _dotNetRef = DotNetObjectReference.Create(this);
 8322            var routes = new[]
 8323            {
 8324                Constants.Routing.HomeRoute,
 8325                Constants.Routing.HistoryRoute,
 8326                Constants.Routing.SettingsRoute,
 8327                Constants.Routing.AboutRoute
 8328            };
 8329            await JSRuntime.InvokeVoidAsync("swipeNavigation.init", _dotNetRef, routes);
 5630        }
 6031    }
 32
 33    [JSInvokable]
 34    public void NavigateTo(string path)
 135    {
 136        NavigationManager.NavigateTo(path);
 137    }
 38
 39    public void Dispose()
 8740    {
 9141        if (_isDisposed) return;
 8342        _isDisposed = true;
 8343        _dotNetRef?.Dispose();
 8344        _ = JSRuntime.InvokeVoidAsync("swipeNavigation.dispose");
 8745    }
 46}