using Bunit; using Xunit; namespace AntDesign.Tests.Button { public class ButtonTests : AntDesignTestBase { [Fact] public void Renders_an_empty_button() { var cut = Context.RenderComponent(); cut.MarkupMatches(@" "); } [Fact] public void Renders_a_button_with_contents() { var cut = Context.RenderComponent(p => p.AddChildContent("Save") ); cut.MarkupMatches(@" "); } [Fact] public void Renders_a_disabled_the_button() { var cut = Context.RenderComponent(p => p.Add(x => x.Disabled, true) ); cut.MarkupMatches(@" "); } [Theory] [InlineData(ButtonType.Dashed)] [InlineData(ButtonType.Default)] [InlineData(ButtonType.Primary)] [InlineData(ButtonType.Link)] public void Renders_buttons_of_different_types(string type) { var cut = Context.RenderComponent(p => p.Add(x => x.Type, type ) ); cut.MarkupMatches($@" "); } [Fact] public void Should_fire_OnClick_when_clicked() { var clicked = false; var cut = Context.RenderComponent(p => p.Add(x => x.OnClick, args => clicked = true) ); var buttonEl = cut.Find("button"); buttonEl.Click(); Assert.True(clicked); } [Fact] public void Renders_loading_icon() { var cut = Context.RenderComponent(p => p.Add(x => x.Loading, true) ); cut.MarkupMatches(@" "); } } }