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
32 changes: 32 additions & 0 deletions src/Ivy.Test/ButtonBadgeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Ivy;
using Xunit;

namespace Ivy.Test;

public class ButtonBadgeTests
{
[Fact]
public void Badge_SetsProperty()
{
var button = new Button("Inbox").Badge("3");

Assert.Equal("3", button.Badge);
}

[Fact]
public void Badge_AndShortcutKey_CoexistWithoutConflict()
{
var button = new Button("Save").Badge("New").ShortcutKey("Ctrl+S");

Assert.Equal("New", button.Badge);
Assert.Equal("Ctrl+S", button.ShortcutKey);
}

[Fact]
public void Badge_Null_ClearsProperty()
{
var button = new Button("Test").Badge("5").Badge(null);

Assert.Null(button.Badge);
}
}
2 changes: 1 addition & 1 deletion src/frontend/src/widgets/button/ButtonWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const ButtonWidget: React.FC<ButtonWidgetProps> = ({
title
)}
{badge && (
<Badge variant="secondary" className="ml-1 w-min whitespace-nowrap">
<Badge variant="outline" className="ml-1 w-min whitespace-nowrap">
{badge}
</Badge>
)}
Expand Down
Loading