< Summary

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BuildRenderTree(...)0%2040%
get_Lines()100%210%
get_OnOptionSelectedCallback()100%210%
.ctor()100%210%
get_Question()0%620%
get_Options()0%620%
OnOptionSelected()0%2040%

File(s)

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

#LineLine coverage
 1<div class="tool-ask-options">
 2<div class="tool-ask-question rz-mb-2">
 03       <strong>@Question</strong>
 4    </div>
 5
 06    @if (Options.Count > 0)
 7    {
 8        <div class="tool-ask-buttons rz-d-flex rz-flex-wrap rz-gap-2">
 09            @foreach (var option in Options)
 10            {
 11               <RadzenButton
 12                    Text="@option"
 13                    ButtonStyle="ButtonStyle.Base"
 14                    Size="ButtonSize.Small"
 015                    Click="@(() => OnOptionSelected(option))" />
 16            }
 17        </div>
 18    }
 19
 20    <div class="tool-ask-custom rz-mt-2 rz-d-flex rz-gap-2">
 21        <RadzenTextBox @bind-Value="_customOption" Placeholder="@SharedResource.YourOption" Style="flex: 1;" />
 22        <RadzenButton
 23            Text="@SharedResource.SendMessage"
 24            ButtonStyle="ButtonStyle.Primary"
 25            Size="ButtonSize.Small"
 26            Disabled="@string.IsNullOrWhiteSpace(_customOption)"
 027            Click="@(() => OnOptionSelected(_customOption))" />
 28    </div>
 29</div>
 30
 31@code {
 032    [Parameter] public List<string> Lines { get; set; } = [];
 033    [Parameter] public EventCallback<string> OnOptionSelectedCallback { get; set; }
 34
 035    private string _customOption = string.Empty;
 36
 037    private string Question => Lines.Count > 0 ? Lines[0] : string.Empty;
 38
 039    private List<string> Options => Lines.Count > 1 ? Lines.Skip(1).ToList() : [];
 40
 41    private async Task OnOptionSelected(string selectedOption)
 42    {
 043        if (string.IsNullOrWhiteSpace(selectedOption))
 044            return;
 45
 046        if (OnOptionSelectedCallback.HasDelegate)
 47        {
 048            await OnOptionSelectedCallback.InvokeAsync(selectedOption);
 49        }
 050    }
 51}