diff --git a/COMET.Web.Common.Tests/Components/CardView/CardViewTestFixture.cs b/COMET.Web.Common.Tests/Components/CardView/CardViewTestFixture.cs index c02b042f..13c2957e 100644 --- a/COMET.Web.Common.Tests/Components/CardView/CardViewTestFixture.cs +++ b/COMET.Web.Common.Tests/Components/CardView/CardViewTestFixture.cs @@ -32,6 +32,7 @@ namespace COMET.Web.Common.Tests.Components.CardView using Microsoft.AspNetCore.Components; using Microsoft.Extensions.DependencyInjection; + using Microsoft.VisualStudio.TestPlatform.Common.Utilities; using NUnit.Framework; @@ -278,6 +279,39 @@ public void VerifyComponentRerenders() }); } + [Test] + public void VerifySelectComponent() + { + var component = this.context.RenderComponent>(parameters => + { + parameters + .Add(p => p.Items, this.testClasses) + .Add(p => p.ItemSize, 150) + .Add(p => p.ItemTemplate, NormalTemplate()); + }); + + var cardView = component; + + Assert.Multiple(() => + { + Assert.That(cardView.Instance.AllowSort, Is.True); + Assert.That(cardView.Instance.AllowSearch, Is.True); + Assert.That(cardView.Instance.ItemSize, Is.EqualTo(150)); + Assert.That(cardView.Instance.SearchFields, Is.EquivalentTo(new[] { "Id", "Name" })); + Assert.That(cardView.Instance.SortFields, Is.EquivalentTo(new[] { string.Empty, "Id", "Name" })); + }); + + var firstCardField = component.Find(".card"); + firstCardField.Click(); + + var selectedCardField = component.Find(".selected"); + + Assert.Multiple(() => + { + Assert.That(firstCardField.InnerHtml, Is.EqualTo(selectedCardField.InnerHtml)); + }); + } + /// /// Configure the for DevExpress ///