Skip to content

Commit 30b9a89

Browse files
committed
Added Test for brand image
1 parent 40f5ec1 commit 30b9a89

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/LinkDotNet.Blog.Web/Shared/NavMenu.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<div class="container-fluid">
77
@if (configuration.BlogBrandUrl != null)
88
{
9-
<a class="nav-brand barcode ms-5" href="/">
10-
<img style="max-height: 110px;"
9+
<a class="nav-brand ms-5" href="/">
10+
<img style="max-height: 62px;"
1111
src="@configuration.BlogBrandUrl.ToAbsoluteUrl(navigationManager.BaseUri)"
1212
alt="brand" />
1313
</a>

tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/NavMenuTests.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Linq;
22
using AngleSharp.Html.Dom;
3+
using AngleSharpWrappers;
34
using Bunit;
45
using Bunit.TestDoubles;
56
using FluentAssertions;
@@ -81,8 +82,28 @@ public void ShouldPassCorrectUriToComponent()
8182
this.AddTestAuthorization();
8283
var cut = RenderComponent<NavMenu>();
8384

84-
Services.GetService<NavigationManager>()!.NavigateTo("test");
85+
Services.GetRequiredService<NavigationManager>().NavigateTo("test");
8586

8687
cut.FindComponent<AccessControl>().Instance.CurrentUri.Should().Contain("test");
8788
}
89+
90+
[Fact]
91+
public void ShouldShowBrandImageIfAvailable()
92+
{
93+
var config = new AppConfiguration
94+
{
95+
ProfileInformation = new ProfileInformation(),
96+
BlogBrandUrl = "http://localhost/img.png",
97+
};
98+
Services.AddScoped(_ => config);
99+
this.AddTestAuthorization();
100+
101+
var cut = RenderComponent<NavMenu>();
102+
103+
var brandImage = cut.Find(".nav-brand img");
104+
105+
var image = brandImage.Unwrap() as IHtmlImageElement;
106+
image.Should().NotBeNull();
107+
image.Source.Should().Be("http://localhost/img.png");
108+
}
88109
}

0 commit comments

Comments
 (0)