Skip to content

Commit 7843cbf

Browse files
authored
Merge pull request #957 from bUnit-dev/release/v1.14
Release of new minor version v1.14
2 parents e961bf7 + 85d2a77 commit 7843cbf

File tree

13 files changed

+53
-18
lines changed

13 files changed

+53
-18
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ All notable changes to **bUnit** will be documented in this file. The project ad
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- Added `IMemoryCache` by default to the Services container. By [@linkdotnet](https://github.com/linkdotnet).
12+
13+
### Fixed
14+
15+
- Added support in `FakeNavigationManager` to handle umlauts.
16+
- Fixed a bug where attribute values did not get escaped. Reported by [@brettwinters](https://github.com/brettwinters). Fixed by [@linkdotnet](https://github.com/linkdotnet).
17+
918
## [1.13.5] - 2022-12-16
1019

1120
This release contains a bunch of small tweaks and fixes.

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<!-- Shared code analyzers used for all projects in the solution -->
4949
<ItemGroup Label="Code Analyzers">
5050
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
51-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.50.0.58025" PrivateAssets="All" />
51+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.51.0.59060" PrivateAssets="All" />
5252
</ItemGroup>
5353

5454
<ItemGroup Label="Implicit usings"

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ A huge thank you to the [sponsors of my work with bUnit](https://github.com/spon
4444
<table border="0">
4545
<tr>
4646
<td align="center" width="120">
47-
<a href="https://github.com/telerik">
48-
<img src="https://avatars.githubusercontent.com/u/568561?s=200&v=4" alt="@Telerik" class="avatar" width="72" height="72" />
47+
<a href="https://github.com/Progress-Telerik">
48+
<img src="https://avatars.githubusercontent.com/u/57092419?s=460" alt="@Progress-Telerik" class="avatar" width="72" height="72" />
4949
<br />
50-
Telerik
50+
Progress Telerik
5151
</a>
5252
</td>
5353
<td align="center" width="120">
@@ -56,7 +56,14 @@ A huge thank you to the [sponsors of my work with bUnit](https://github.com/spon
5656
<br />
5757
Syncfusion
5858
</a>
59-
</td>
59+
</td>
60+
<td align="center" width="120">
61+
<a href="https://github.com/aws">
62+
<img class="avatar" src="https://avatars.githubusercontent.com/u/2232217?s=200&v=4" width="72" height="72" alt="@aws" />
63+
<br />
64+
Amazon Web Services
65+
</a>
66+
</td>
6067
<td align="center" width="120">
6168
<a href="https://github.com/hassanhabib">
6269
<img src="https://avatars.githubusercontent.com/u/1453985?s=460" alt="Hassan Rezk Habib (@hassanhabib)" width="72" height="72" class="avatar" />

benchmark/bunit.benchmarks/bunit.benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
11+
<PackageReference Include="BenchmarkDotNet" Version="0.13.3" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

src/bunit.web/Extensions/TestServiceProviderExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Components.Authorization;
66
using Microsoft.AspNetCore.Components.Routing;
77
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
8+
using Microsoft.Extensions.Caching.Memory;
89
using Microsoft.Extensions.Localization;
910

1011
namespace Bunit.Extensions;
@@ -54,6 +55,8 @@ public static IServiceCollection AddDefaultTestContextServices(this IServiceColl
5455
services.AddSingleton<BunitHtmlParser>();
5556
services.AddSingleton<IRenderedComponentActivator, RenderedComponentActivator>();
5657

58+
services.AddMemoryCache();
59+
5760
#if NET6_0_OR_GREATER
5861
services.AddSingleton<IErrorBoundaryLogger, BunitErrorBoundaryLogger>();
5962
#endif

src/bunit.web/Rendering/Internal/Htmlizer.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Globalization;
77
using System.Text;
88
using System.Text.Encodings.Web;
9+
using System.Text.Unicode;
910
using Bunit.Rendering;
1011

1112
namespace Bunit;
@@ -270,7 +271,7 @@ private static int RenderAttributes(
270271
result.Append(frame.AttributeName);
271272
result.Append('=');
272273
result.Append('"');
273-
result.Append(value);
274+
result.Append(Escape(value));
274275
result.Append('"');
275276
break;
276277
default:
@@ -281,6 +282,11 @@ private static int RenderAttributes(
281282
return position + maxElements;
282283
}
283284

285+
private static string Escape(string value) =>
286+
value
287+
.Replace("&", "&amp;", StringComparison.OrdinalIgnoreCase)
288+
.Replace("\"", "&quot;", StringComparison.OrdinalIgnoreCase);
289+
284290
private sealed class HtmlRenderingContext
285291
{
286292
private readonly RenderTreeFrameDictionary frames;

src/bunit.web/TestDoubles/NavigationManager/FakeNavigationManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ protected override void HandleLocationChangingHandlerException(Exception ex, Loc
142142
#endif
143143

144144
private URI GetNewAbsoluteUri(string uri)
145-
=> URI.IsWellFormedUriString(uri, UriKind.Relative)
146-
? ToAbsoluteUri(uri)
147-
: new URI(uri, UriKind.Absolute);
145+
=> new URI(uri, UriKind.RelativeOrAbsolute).IsAbsoluteUri
146+
? new URI(uri, UriKind.RelativeOrAbsolute) : ToAbsoluteUri(uri);
148147

149148
private bool HasDifferentBaseUri(URI absoluteUri)
150149
=> URI.Compare(

src/bunit.web/bunit.web.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(DotNet3Version)" />
2525
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNet3Version)" />
2626
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet3Version)" />
27+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(DotNet3Version)" />
2728
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
2829
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="3.2.1" />
2930
</ItemGroup>
@@ -32,13 +33,15 @@
3233
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(DotNet5Version)" />
3334
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNet5Version)" />
3435
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet5Version)" />
36+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(DotNet5Version)" />
3537
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(DotNet5Version)" />
3638
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet5Version)" />
3739
</ItemGroup>
3840

3941
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
4042
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(DotNet6Version)" />
4143
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet6Version)" />
44+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(DotNet6Version)" />
4245
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNet6Version)" />
4346
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(DotNet6Version)" />
4447
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet6Version)" />
@@ -47,6 +50,7 @@
4750
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
4851
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(DotNet7Version)" />
4952
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet7Version)" />
53+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(DotNet7Version)" />
5054
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNet7Version)" />
5155
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(DotNet7Version)" />
5256
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet7Version)" />
@@ -82,4 +86,4 @@
8286
<Using Include="Microsoft.JSInterop" />
8387
</ItemGroup>
8488

85-
</Project>
89+
</Project>

tests/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<ItemGroup Condition="$(MSBuildProjectName) != 'bunit.testassets'">
1717
<PackageReference Include="AutoFixture" Version="4.17.0" />
1818
<PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
20-
<PackageReference Include="Moq" Version="4.18.3" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
20+
<PackageReference Include="Moq" Version="4.18.4" />
2121
<PackageReference Include="Shouldly" Version="4.1.0" />
2222
<PackageReference Include="xunit" Version="2.4.2" />
2323
<PackageReference Include="Xunit.Combinatorial" Version="1.5.25" />
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<p style="@Escaped">@Escaped</p>
22

33
@code {
4-
private string Escaped => "url('')";
4+
5+
[Parameter]
6+
public string Escaped { get; set; }
7+
58
}

0 commit comments

Comments
 (0)