< Summary

Information
Class: UIBlazor.Components.ToolViews.MarkdownBlock
Assembly: UIBlazor
File(s): /home/runner/work/InvAit/InvAit/UIBlazor/Components/ToolViews/MarkdownBlock.razor
Tag: 71_26091983037
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Content()100%210%
.ctor()100%210%
ShouldRender()100%210%
OnAfterRenderAsync()0%620%

File(s)

/home/runner/work/InvAit/InvAit/UIBlazor/Components/ToolViews/MarkdownBlock.razor

#LineLine coverage
 1@inject IJSRuntime Js
 2
 3<div id="@_blockId" class="markdown-content">
 4</div>
 5
 6@code {
 07    [Parameter] public string Content { get; set; } = string.Empty;
 8
 09    private readonly string _blockId = $"md-{Guid.NewGuid()}";
 010    private string _lastRenderedContent = string.Empty;
 11
 012    protected override bool ShouldRender() => Content != _lastRenderedContent;
 13
 14    protected override async Task OnAfterRenderAsync(bool firstRender)
 15    {
 016        if (Content != _lastRenderedContent)
 17        {
 018            _lastRenderedContent = Content;
 19            try
 20            {
 021                await Js.InvokeVoidAsync("renderMarkdownToElement", _blockId, Content);
 022            }
 023            catch (JSException)
 24            {
 25                // Ignore JS errors during rendering if element is disposed
 026            }
 27        }
 028    }
 29}