Skip to content

Commit

Permalink
Added class and style to menu item pass through
Browse files Browse the repository at this point in the history
Added menu test for class pass thorough
  • Loading branch information
greg-voxel authored and mikes-gh committed Mar 25, 2021
1 parent d49e87a commit 6a77e41
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@namespace MudBlazor.UnitTests.TestComponents

<MudMenu Label="Full Menu Width" Variant="Variant.Filled" Color="Color.Primary" FullWidth="true">
<MudMenuItem>1</MudMenuItem>
<MudMenuItem Class="test-class">1</MudMenuItem>
<MudMenuItem Link="https://www.test.com">2</MudMenuItem>
<MudMenuItem Link="https://www.test.com" Target="_blank">3</MudMenuItem>
</MudMenu>
9 changes: 9 additions & 0 deletions src/MudBlazor.UnitTests/Components/MenuTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@ public void OpenMenu_ClickThirdItem_CheckClosed()
comp.FindAll("div.mud-list-item")[2].Click();
comp.FindAll("div.mud-popover-open").Count.Should().Be(0);
}

[Test]
public void OpenMenu_ClickClassItem_CheckClass()
{
var comp = ctx.RenderComponent<MenuTest1>();
comp.FindAll("button.mud-button-root")[0].Click();
comp.FindAll("div.mud-list-item").Count.Should().Be(3);
comp.FindAll("div.mud-list-item.test-class").Count.Should().Be(1);
}
}
}
2 changes: 1 addition & 1 deletion src/MudBlazor/Components/Menu/MudMenuItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@



<MudListItem @onclick="OnClickHandler" Disabled="@Disabled">
<MudListItem @onclick="OnClickHandler" Disabled="@Disabled" Class="@Class" Style="@Style">
@ChildContent
</MudListItem>

Expand Down

0 comments on commit 6a77e41

Please # to comment.