diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelHtmlAttributesTest.razor b/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelHtmlAttributesTest.razor
new file mode 100644
index 0000000000..a57d12eaf0
--- /dev/null
+++ b/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelHtmlAttributesTest.razor
@@ -0,0 +1 @@
+I'm a label
\ No newline at end of file
diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTest.razor b/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTest.razor
deleted file mode 100644
index 025a4858f9..0000000000
--- a/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTest.razor
+++ /dev/null
@@ -1,6 +0,0 @@
-
-I'm a label
-
-@code {
- [Parameter] public bool IsRequired { get; set; }
-}
diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTests.cs
index a7a1c66f59..d221df97a1 100644
--- a/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTests.cs
+++ b/src/BlazorUI/Bit.BlazorUI.Tests/Labels/BitLabelTests.cs
@@ -6,11 +6,199 @@ namespace Bit.BlazorUI.Tests.Labels;
[TestClass]
public class BitLabelTests : BunitTestContext
{
- [DataTestMethod, DataRow(true, true), DataRow(false, false)]
- public void BitLabelShouldRespectIsRequired(bool isRequired, bool expectedResult)
+ [DataTestMethod]
+ public void BitLabelShouldRenderExpectedElement()
{
- var component = RenderComponent(parameters => parameters.Add(p => p.IsRequired, isRequired));
- var bitLabel = component.Find(".bit-lbl");
- Assert.AreEqual(expectedResult, bitLabel.ClassList.Contains("bit-lbl-req"));
+ var component = RenderComponent();
+
+ component.MarkupMatches(@"");
+ }
+
+ [DataTestMethod,
+ DataRow(true),
+ DataRow(false)
+ ]
+ public void BitLabelShouldRespectIsEnabled(bool isEnabled)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.IsEnabled, isEnabled);
+ });
+
+ var cssClass = isEnabled ? "bit-lbl" : "bit-lbl bit-dis";
+
+ component.MarkupMatches(@$"");
+ }
+
+ [DataTestMethod,
+ DataRow(true),
+ DataRow(false)
+ ]
+ public void BitLabelShouldRespectRequired(bool required)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Required, required);
+ });
+
+ var cssClass = required ? "bit-lbl bit-lbl-req" : "bit-lbl";
+
+ component.MarkupMatches(@$"");
+ }
+
+ [DataTestMethod,
+ DataRow("font-size: 14px; color: red;"),
+ DataRow("padding: 1rem;"),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectStyle(string style)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Style, style);
+ });
+
+ if (style.HasNoValue())
+ {
+ component.MarkupMatches(@"");
+ }
+ else
+ {
+ component.MarkupMatches(@$"");
+ }
+ }
+
+ [DataTestMethod,
+ DataRow("test-class"),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectClass(string @class)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Class, @class);
+ });
+
+ var cssClass = @class.HasValue() ? $"bit-lbl {@class}" : "bit-lbl";
+
+ component.MarkupMatches(@$"");
+ }
+
+ [DataTestMethod,
+ DataRow("test-id"),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectId(string id)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Id, id);
+ });
+
+
+ if (id.HasNoValue())
+ {
+ component.MarkupMatches(@$"");
+ }
+ else
+ {
+ component.MarkupMatches(@$"");
+ }
+ }
+
+ [DataTestMethod,
+ DataRow("test-for"),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectFor(string @for)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.For, @for);
+ });
+
+
+ if (@for.HasNoValue())
+ {
+ component.MarkupMatches(@"");
+ }
+ else
+ {
+ component.MarkupMatches(@$"");
+ }
+ }
+
+ [DataTestMethod,
+ DataRow(BitDir.Rtl),
+ DataRow(BitDir.Ltr),
+ DataRow(BitDir.Auto),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectDir(BitDir? dir)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Dir, dir);
+ });
+
+ if (dir.HasValue)
+ {
+ var cssClass = dir is BitDir.Rtl ? "bit-lbl bit-rtl" : "bit-lbl";
+ component.MarkupMatches(@$"");
+ }
+ else
+ {
+ component.MarkupMatches(@"");
+ }
+ }
+
+ [DataTestMethod,
+ DataRow(BitVisibility.Visible),
+ DataRow(BitVisibility.Collapsed),
+ DataRow(BitVisibility.Hidden)
+ ]
+ public void BitLabelShouldRespectVisibility(BitVisibility visibility)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.Add(p => p.Visibility, visibility);
+ });
+
+
+ switch (visibility)
+ {
+ case BitVisibility.Visible:
+ component.MarkupMatches(@"");
+ break;
+ case BitVisibility.Hidden:
+ component.MarkupMatches(@"");
+ break;
+ case BitVisibility.Collapsed:
+ component.MarkupMatches(@"");
+ break;
+ }
+ }
+
+ [DataTestMethod,
+ DataRow("Bit Blazor UI"),
+ DataRow("Bit Blazor UI"),
+ DataRow(null)
+ ]
+ public void BitLabelShouldRespectChildContent(string childContent)
+ {
+ var component = RenderComponent(parameters =>
+ {
+ parameters.AddChildContent(childContent);
+ });
+
+ component.MarkupMatches(@$"");
+ }
+
+ [DataTestMethod]
+ public void BitLabelShouldRespectHtmlAttributes()
+ {
+ var component = RenderComponent();
+
+ component.MarkupMatches(@"");
}
}