forked from CodeBeamOrg/CodeBeam.MudBlazor.Extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChipFieldTests.cs
More file actions
26 lines (25 loc) · 977 Bytes
/
ChipFieldTests.cs
File metadata and controls
26 lines (25 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using MudExtensions.Docs.Examples;
using FluentAssertions;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace MudExtensions.UnitTests.Components
{
[TestFixture]
public class ChipFieldTests : BunitTest
{
[Test]
public async Task ChipFieldBasicTest()
{
var comp = Context.RenderComponent<MudChipField<string>>(opt =>
{
opt.Add(a => a.Values, new List<string> { "asdf", "asd" });
});
var field = comp.FindComponent<MudTextFieldExtended<string>>();
field.Find("input").Input(new ChangeEventArgs() { Value = "sdfg" });
await comp.InvokeAsync(() => comp.Instance.HandleKeyDown(new KeyboardEventArgs() { Key = " " }));
comp.Instance.Values.Should().BeEquivalentTo(new List<string> { "asdf", "asd", "sdfg" });
comp.Instance.Value.Should().BeEquivalentTo(null);
}
}
}