Skip to content

Commit

Permalink
refactor: More simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Feb 22, 2024
1 parent 652e0be commit 2dc2b23
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public void ShouldSetAbsoluteUriForOgData(string givenUri, string expectedUri)

var cut = ctx.RenderComponent<Index>();

cut.WaitForState(() => cut.FindComponents<OgData>().Any());
cut.FindComponent<OgData>().Instance.AbsolutePreviewImageUrl.Should().Be(expectedUri);
cut.WaitForComponent<OgData>().Instance.AbsolutePreviewImageUrl.Should().Be(expectedUri);
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ public async Task ShouldFindBlogPostWhenTitleMatches()

var cut = ctx.RenderComponent<SearchPage>(p => p.Add(s => s.SearchTerm, "Title 1"));

cut.WaitForState(() => cut.FindComponents<ShortBlogPost>().Any());
var blogPosts = cut.FindComponents<ShortBlogPost>();
blogPosts.Should().HaveCount(1);
blogPosts.Single().Find(".description h1").TextContent.Should().Be("Title 1");
var blogPosts = cut.WaitForComponent<ShortBlogPost>();
blogPosts.Find(".description h1").TextContent.Should().Be("Title 1");
}

[Fact]
Expand All @@ -41,10 +39,8 @@ public async Task ShouldFindBlogPostWhenTagMatches()

var cut = ctx.RenderComponent<SearchPage>(p => p.Add(s => s.SearchTerm, "Cat"));

cut.WaitForState(() => cut.FindComponents<ShortBlogPost>().Any());
var blogPosts = cut.FindComponents<ShortBlogPost>();
blogPosts.Should().HaveCount(1);
blogPosts.Single().Find(".description h1").TextContent.Should().Be("Title 1");
var blogPost = cut.WaitForComponent<ShortBlogPost>();
blogPost.Find(".description h1").TextContent.Should().Be("Title 1");
}

[Fact]
Expand All @@ -57,10 +53,8 @@ public async Task ShouldUnescapeQuery()

var cut = ctx.RenderComponent<SearchPage>(p => p.Add(s => s.SearchTerm, "Title%201"));

cut.WaitForState(() => cut.FindComponents<ShortBlogPost>().Any());
var blogPosts = cut.FindComponents<ShortBlogPost>();
blogPosts.Should().HaveCount(1);
blogPosts.Single().Find(".description h1").TextContent.Should().Be("Title 1");
var blogPosts = cut.WaitForComponent<ShortBlogPost>();
blogPosts.Find(".description h1").TextContent.Should().Be("Title 1");
}

private void RegisterServices(TestContext ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public async Task ShouldNotAllowToEditSkillTagsWhenNotAdmin()
var cut = ctx.RenderComponent<SkillTable>(p =>
p.Add(s => s.ShowAdminActions, false));

cut.WaitForState(() => cut.FindComponents<SkillTag>().Any());
cut.FindComponent<SkillTag>().Instance.ShowAdminActions.Should().BeFalse();
cut.WaitForComponent<SkillTag>().Instance.ShowAdminActions.Should().BeFalse();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public void ShouldDisplaySitemap()

cut.Find("button").Click();

cut.WaitForState(() => cut.FindAll("tr").Count > 1);
var row = cut.FindAll("tr").Last();
var row = cut.WaitForElements("tr").Last();
row.Children.First().InnerHtml.Should().Be("loc");
row.Children.Last().InnerHtml.Should().Be("Now");
}
Expand Down

0 comments on commit 2dc2b23

Please sign in to comment.