Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.*" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
<PackageReference Include="MudBlazor" Version="8.0.0-preview.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion CodeBeam.MudBlazor.Extensions.Docs/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<div class="d-flex justify-center my-4">
<MudAutocomplete @bind-Value="_searchedComponent" @bind-Value:after="NavigateSelectedComponent" SearchFunc="@ComponentSearch" Class="search-style" Style="width: calc(50px + 50vw)" MinCharacters="1"
Color="Color.Secondary" Variant="Variant.Outlined" Placeholder="What are you looking for?" Clearable="true" AdornmentIcon="@Icons.Material.Filled.Search"
ProgressIndicatorColor="Color.Secondary" Variant="Variant.Outlined" Placeholder="What are you looking for?" Clearable="true" AdornmentIcon="@Icons.Material.Filled.Search"
Adornment="Adornment.Start" AdornmentColor="Color.Secondary" ToStringFunc="@(e => e?.Component?.Name.Replace("`1", null))" MaxItems="null"
HelperText='Write "mud" to see all. Also can search from labels - write "utility".'>
<ItemTemplate>
Expand Down
2 changes: 1 addition & 1 deletion CodeBeam.MudBlazor.Extensions.Docs/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

Typography = new Typography()
{
Default = new Default()
Default = new DefaultTypography()
{
FontFamily = new[] { font, "Roboto", "Poppins", "Helvetica", "sans-serif" }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

class CoffeeComparer : IEqualityComparer<Coffee>
{
public bool Equals(Coffee a, Coffee b) => a.Key == b.Key;
public bool Equals(Coffee? a, Coffee? b) => a?.Key == b?.Key;
public int GetHashCode(Coffee x) => HashCode.Combine(x.Key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
string fruit = "Apple";
public int ChangeCount { get; private set; }

void FruitChanged(IEnumerable<string> fruits)
void FruitChanged(IEnumerable<string>? fruits)
{
ChangeCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public static string __description__ = "Click should open the Menu and selecting a value should update the bindable value.";

[Parameter]
public string SelectedValue { get; set; }
public string? SelectedValue { get; set; }
[Parameter]
public IEnumerable<string> SelectedValues { get; set; }
public IEnumerable<string?>? SelectedValues { get; set; }
[Parameter]
public bool MultiSelection { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" Version="1.27.17" />
<PackageReference Include="bunit" Version="1.36.0" />
<PackageReference Include="CodecovUploader" Version="0.7.2" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.1.0">
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
118 changes: 59 additions & 59 deletions CodeBeam.MudBlazor.Extensions.UnitTests/Components/ComboboxTests.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -260,60 +260,60 @@ public async Task List_KeyboardNavigationTest()
//Console.WriteLine(comp.Markup);
var list = comp.FindComponent<MudListExtended<int>>().Instance;

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "ArrowDown" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().BeNullOrEmpty());

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Enter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Enter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().ContainSingle());
//Second item is functional, should skip.
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "ArrowDown" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeFalse());
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[2].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().ContainSingle());

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "NumpadEnter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "NumpadEnter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[2].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().ContainInOrder(new int[] { 1, 3 }));

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Enter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Enter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[2].Instance.IsActive.Should().BeFalse());
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[5].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(3));
comp.WaitForAssertion(() => list.SelectedValues.Should().Contain(5));

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Enter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Enter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[5].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(2));
comp.WaitForAssertion(() => list.SelectedValues.Should().Contain(3));
//Last disabled item should not be active
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "End" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "End" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[9].Instance.IsActive.Should().BeTrue());

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Home" }));
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Enter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Home" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Enter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(1));
comp.WaitForAssertion(() => list.SelectedValues.Should().NotContain(1));

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "a", CtrlKey = true }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "a", CtrlKey = true }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(7));
comp.WaitForAssertion(() => list.SelectedValues.Should().NotContain(2));

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "A", CtrlKey = true }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "A", CtrlKey = true }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[0].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(0));

await comp.InvokeAsync(() => comp.FindAll("div.mud-list-item-extended")[5].Click());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(1));
comp.WaitForAssertion(() => list.SelectedValues.Should().Contain(5));

await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDown(new KeyboardEventArgs() { Key = "Enter" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "ArrowDown" }));
await comp.InvokeAsync(() => list.HandleKeyDownAsync(new KeyboardEventArgs() { Key = "Enter" }));
comp.WaitForAssertion(() => comp.FindComponents<MudListItemExtended<int>>()[6].Instance.IsActive.Should().BeTrue());
comp.WaitForAssertion(() => list.SelectedValues.Should().HaveCount(2));
comp.WaitForAssertion(() => list.SelectedValues.Should().Contain(6));
Expand Down
Loading
Loading