Skip to content

Commit 551c0f9

Browse files
committed
Fixed tests
1 parent ade5a7d commit 551c0f9

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

LinkDotNet.Blog.UnitTests/Web/Shared/Admin/CreateNewBlogPostTests.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Linq;
2+
using AngleSharp.Dom;
23
using Bunit;
34
using FluentAssertions;
45
using LinkDotNet.Blog.TestUtilities;
@@ -56,6 +57,27 @@ public void ShouldFillGivenBlogPost()
5657
blogPostFromComponent.Content.Should().Be("Content");
5758
}
5859

60+
[Fact]
61+
public void ShouldNotDeleteModelWhenSet()
62+
{
63+
using var ctx = new TestContext();
64+
BlogPost blogPost = null;
65+
var cut = ctx.RenderComponent<CreateNewBlogPost>(
66+
p => p.Add(c => c.ClearAfterCreated, true)
67+
.Add(c => c.OnBlogPostCreated, post => blogPost = post));
68+
cut.Find("#title").Change("My Title");
69+
cut.Find("#short").Change("My short Description");
70+
cut.Find("#content").Change("My content");
71+
cut.Find("#preview").Change("My preview url");
72+
cut.Find("#tags").Change("Tag1,Tag2,Tag3");
73+
cut.Find("form").Submit();
74+
blogPost = null;
75+
76+
cut.Find("form").Submit();
77+
78+
blogPost.Should().BeNull();
79+
}
80+
5981
[Fact]
6082
public void ShouldNotDeleteModelWhenNotSet()
6183
{
@@ -69,12 +91,12 @@ public void ShouldNotDeleteModelWhenNotSet()
6991
cut.Find("#content").Change("My content");
7092
cut.Find("#preview").Change("My preview url");
7193
cut.Find("#tags").Change("Tag1,Tag2,Tag3");
94+
cut.Find("form").Submit();
95+
blogPost = null;
7296

7397
cut.Find("form").Submit();
7498

75-
cut.
76-
cut.WaitForState(() => blogPost != null);
77-
cut.Find("#title").TextContent.Should().Be("My Title");
99+
blogPost.Should().NotBeNull();
78100
}
79101
}
80102
}

0 commit comments

Comments
 (0)