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
20 changes: 0 additions & 20 deletions src/BlazorUI/Bit.BlazorUI.Tests/Pivot/BitPivotTest.razor

This file was deleted.

50 changes: 28 additions & 22 deletions src/BlazorUI/Bit.BlazorUI.Tests/Pivot/BitPivotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ namespace Bit.BlazorUI.Tests.Pivot;
public class BitPivotTests : BunitTestContext
{
[DataTestMethod,
DataRow(BitPivotLinkFormat.Links, BitPivotLinkSize.Large, BitPivotOverflowBehavior.None),
DataRow(BitPivotLinkFormat.Tabs, BitPivotLinkSize.Normal, BitPivotOverflowBehavior.Scroll),
DataRow(BitPivotLinkFormat.Tabs, BitPivotLinkSize.Normal, BitPivotOverflowBehavior.Menu)]
DataRow(BitPivotLinkFormat.Links, BitPivotLinkSize.Large, BitPivotOverflowBehavior.None),
DataRow(BitPivotLinkFormat.Tabs, BitPivotLinkSize.Normal, BitPivotOverflowBehavior.Scroll),
DataRow(BitPivotLinkFormat.Tabs, BitPivotLinkSize.Normal, BitPivotOverflowBehavior.Menu)
]
public void BitPivotShouldRespectLinkFormatClasses(BitPivotLinkFormat linkFormat, BitPivotLinkSize linkSize, BitPivotOverflowBehavior overflowBehavior)
{
var component = RenderComponent<BitPivotTest>(parameters =>
var component = RenderComponent<BitPivot>(parameters =>
{
parameters.Add(p => p.LinkFormat, linkFormat);
parameters.Add(p => p.LinkSize, linkSize);
Expand All @@ -23,36 +24,37 @@ public void BitPivotShouldRespectLinkFormatClasses(BitPivotLinkFormat linkFormat
var linkSizeClass = linkSize.ToString().ToLower();
var overflowBehaviorClass = overflowBehavior.ToString().ToLower();

var bitPivot = component.Find($".bit-pvt");
var bitPivot = component.Find(".bit-pvt");

Assert.IsTrue(bitPivot.ClassList.Contains(linkFormatClass));
Assert.IsTrue(bitPivot.ClassList.Contains(linkSizeClass));
Assert.IsTrue(bitPivot.ClassList.Contains(overflowBehaviorClass));
}


[Ignore("bypassed - BUnit 2-way bound parameters issue")]
[DataTestMethod,
DataRow(false, false),
DataRow(true, true)]
DataRow(false, false),
DataRow(true, true)
]
public void BitPivotShouldRespectSelectKey(bool isEnabled, bool expectedResult)
{
var component = RenderComponent<BitPivotTest>(parameters =>
var component = RenderComponent<BitPivot>(parameters =>
{
parameters.AddCascadingValue(this);
parameters.AddChildContent<BitPivotItem>();
parameters.AddChildContent<BitPivotItem>(parameters => parameters.Add(p => p.IsEnabled, isEnabled));
});

//component.FindAll(".bit-pvt > div:first-child > div")[1].Click();
component.FindAll(".bit-pvt > div:first-child > div")[1].Click();

//TODO: bypassed - BUnit 2-way bound parameters issue
//Assert.AreEqual(component.FindAll(".bit-pvt > div:first-child > div")[1].ClassList.Contains("selected-item"), expectedResult);
Assert.AreEqual(component.FindAll(".bit-pvt > div:first-child > div")[1].ClassList.Contains("selected-item"), expectedResult);
}

[DataTestMethod, DataRow("Detailed label")]
public void BitPivotAriaLabelTest(string ariaLabel)
{
var com = RenderComponent<BitPivotTest>(parameters =>
var com = RenderComponent<BitPivot>(parameters =>
{
parameters.AddChildContent<BitPivotItem>();
parameters.AddChildContent<BitPivotItem>(parameters => parameters.Add(p => p.AriaLabel, ariaLabel));
Expand All @@ -67,22 +69,26 @@ public void BitPivotAriaLabelTest(string ariaLabel)
}

[DataTestMethod,
DataRow(BitPivotPosition.Top),
DataRow(BitPivotPosition.Bottom),
DataRow(BitPivotPosition.Left),
DataRow(BitPivotPosition.Right)]
DataRow(BitPivotPosition.Top),
DataRow(BitPivotPosition.Bottom),
DataRow(BitPivotPosition.Left),
DataRow(BitPivotPosition.Right)
]
public void BitPivotShouldRespectPosition(BitPivotPosition position)
{
var component = RenderComponent<BitPivotTest>(parameters =>
var component = RenderComponent<BitPivot>(parameters =>
{
parameters.Add(p => p.Position, position);
});

var positionClass = position == BitPivotPosition.Top ? $"position-top"
: position == BitPivotPosition.Bottom ? $"position-bottom"
: position == BitPivotPosition.Left ? $"position-left"
: position == BitPivotPosition.Right ? $"position-right"
: string.Empty;
var positionClass = position switch
{
BitPivotPosition.Top => "position-top",
BitPivotPosition.Bottom => "position-bottom",
BitPivotPosition.Left => "position-left",
BitPivotPosition.Right => "position-right",
_ => string.Empty
};

var bitPivot = component.Find(".bit-pvt");

Expand Down