Skip to content

Commit 741417e

Browse files
committed
Added Test for oninput for create new blog post
1 parent bd2ddb3 commit 741417e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,31 @@ public void ShouldNotSetOptionToNotUpdateUpdatedDateOnInitialCreate()
135135

136136
found.Should().HaveCount(0);
137137
}
138+
139+
[Fact]
140+
public void ShouldAcceptInputWithoutLosingFocusOrEnter()
141+
{
142+
BlogPost blogPost = null;
143+
var cut = RenderComponent<CreateNewBlogPost>(
144+
p => p.Add(c => c.OnBlogPostCreated, bp => blogPost = bp));
145+
cut.Find("#title").Input("My Title");
146+
cut.Find("#short").Input("My short Description");
147+
cut.Find("#content").Input("My content");
148+
cut.Find("#preview").Change("My preview url");
149+
cut.Find("#published").Change(false);
150+
cut.Find("#tags").Change("Tag1,Tag2,Tag3");
151+
152+
cut.Find("form").Submit();
153+
154+
cut.WaitForState(() => cut.Find("#title").TextContent == string.Empty);
155+
blogPost.Should().NotBeNull();
156+
blogPost.Title.Should().Be("My Title");
157+
blogPost.ShortDescription.Should().Be("My short Description");
158+
blogPost.Content.Should().Be("My content");
159+
blogPost.PreviewImageUrl.Should().Be("My preview url");
160+
blogPost.IsPublished.Should().BeFalse();
161+
blogPost.Tags.Should().HaveCount(3);
162+
blogPost.Tags.Select(t => t.Content).Should().Contain(new[] { "Tag1", "Tag2", "Tag3" });
163+
}
138164
}
139165
}

0 commit comments

Comments
 (0)