From 388a298d85a535e582426f251e1772e99772c166 Mon Sep 17 00:00:00 2001 From: Mohammad Aminsafaei Date: Wed, 30 Oct 2024 09:30:40 +0330 Subject: [PATCH] feat(blazorui): add new tests for BitSeparator component #8900 (#9056) --- .../Utilities/Separator/BitSeparatorTests.cs | 86 ++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Separator/BitSeparatorTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Separator/BitSeparatorTests.cs index 34c1816580..5cab330725 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Separator/BitSeparatorTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Separator/BitSeparatorTests.cs @@ -366,7 +366,7 @@ public void BitSeparatorShouldRespectAutoSize(bool autoSize) } [DataTestMethod] - public void BitSeparatorShouldRespectFullWidthChangingAfterRender() + public void BitSeparatorShouldRespectAutoSizeChangingAfterRender() { var component = RenderComponent(); @@ -380,6 +380,88 @@ public void BitSeparatorShouldRespectFullWidthChangingAfterRender() component.MarkupMatches(@"
"); } + [DataTestMethod, + DataRow(null), + DataRow(BitColorKind.Primary), + DataRow(BitColorKind.Secondary), + DataRow(BitColorKind.Tertiary), + DataRow(BitColorKind.Transparent) + ] + public void BitSeparatorShouldRespectBackground(BitColorKind? background) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.Background, background); + }); + + var cssClass = background switch + { + BitColorKind.Primary => "bit-spr-pbg", + BitColorKind.Secondary => "bit-spr-sbg", + BitColorKind.Tertiary => "bit-spr-tbg", + BitColorKind.Transparent => "bit-spr-rbg", + _ => null + }; + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod] + public void BitSeparatorShouldRespectBackgroundChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.Background, BitColorKind.Secondary); + }); + + component.MarkupMatches(@"
"); + } + + [DataTestMethod, + DataRow(null), + DataRow(BitColorKind.Primary), + DataRow(BitColorKind.Secondary), + DataRow(BitColorKind.Tertiary), + DataRow(BitColorKind.Transparent) + ] + public void BitSeparatorShouldRespectBorder(BitColorKind? border) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.Border, border); + }); + + var cssClass = border switch + { + BitColorKind.Primary => "bit-spr-pbr", + BitColorKind.Secondary => "bit-spr-sbr", + BitColorKind.Tertiary => "bit-spr-tbr", + BitColorKind.Transparent => "bit-spr-rbr", + _ => null + }; + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod] + public void BitSeparatorShouldRespectBorderChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.Border, BitColorKind.Secondary); + }); + + component.MarkupMatches(@"
"); + } + [DataTestMethod, DataRow(true), DataRow(false) @@ -403,7 +485,7 @@ public void BitSeparatorShouldRespectAutoSizeInVertical(bool autoSize) } [DataTestMethod] - public void BitSeparatorShouldRespectFullWidthChangingAfterRenderInVertical() + public void BitSeparatorShouldRespectAutoSizeChangingAfterRenderInVertical() { var component = RenderComponent(parameters => {