Skip to content

Commit a6ef95f

Browse files
authored
Merge pull request #1701 from bUnit-dev/release/v1.39
Release of new minor version v1.39
2 parents c91ef3d + 971e4b8 commit a6ef95f

26 files changed

+162
-74
lines changed

CHANGELOG.md

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

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Do not set the `Uri` or `BaseUri` property on the `FakeNavigationManager` if navigation is prevented by a handler on `net7.0` or greater. Reported and fixed by [@ayyron-dev](https://github.com/ayyron-dev) in [#1647](https://github.com/bUnit-dev/bUnit/issues/1647)
12+
- Use default renderer properties for AngleSharp. Reported by [@jtleaming](https://github.com/jtleaming) in [#1692].
13+
- `FindComponents` throws an exception, when a base and derived class was searched for. Reported by [@BlueDragon709](https://github.com/BlueDragon709) in [#1691].
14+
915
## [1.38.5] - 2025-01-12
1016

1117
### Added

Directory.Packages.props

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!-- Shared code analyzers used for all projects in the solution -->
77
<ItemGroup Condition="!$(MSBuildProjectName.EndsWith('samples'))">
88
<GlobalPackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" IncludeAssets="Runtime;Build;Native;contentFiles;Analyzers"/>
9-
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" PrivateAssets="All" IncludeAssets="Runtime;Build;Native;contentFiles;Analyzers"/>
9+
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.5.0.109200" PrivateAssets="All" IncludeAssets="Runtime;Build;Native;contentFiles;Analyzers"/>
1010
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
1111
<PackageVersion Include="Meziantou.Polyfill" Version="1.0.42" />
1212
</ItemGroup>
@@ -28,7 +28,7 @@
2828

2929
<ItemGroup Label="System.Text.Json Vulnerability">
3030
<!-- Due to a CVE in System.Text.Json we explicitly reference the latest version of System.Text.Json -->
31-
<PackageVersion Include="System.Text.Json" Version="9.0.0"/>
31+
<PackageVersion Include="System.Text.Json" Version="9.0.1"/>
3232
</ItemGroup>
3333

3434
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
@@ -97,16 +97,16 @@
9797
</ItemGroup>
9898

9999
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
100-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0"/>
101-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0"/>
102-
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.0"/>
103-
104-
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.0"/>
105-
<PackageVersion Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.0"/>
106-
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0"/>
107-
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0"/>
108-
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0"/>
109-
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.0"/>
100+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.1"/>
101+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.1"/>
102+
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.1"/>
103+
104+
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.1"/>
105+
<PackageVersion Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.1"/>
106+
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.1"/>
107+
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.1"/>
108+
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.1"/>
109+
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.1"/>
110110
</ItemGroup>
111111

112112
<ItemGroup Label="Test Dependencies">
@@ -122,7 +122,7 @@
122122
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
123123
<PackageVersion Include="Shouldly" Version="4.2.1"/>
124124
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0"/>
125-
<PackageVersion Include="Verify.Xunit" Version="28.8.1"/>
125+
<PackageVersion Include="Verify.Xunit" Version="28.9.0"/>
126126
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24"/>
127127
<PackageVersion Include="coverlet.collector" Version="6.0.3" />
128128
<PackageVersion Include="coverlet.msbuild" Version="6.0.3" />

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ A huge thank you to the [sponsors of bUnit](https://github.com/sponsors/egil). T
3838
<table border="0">
3939
<tr>
4040
<td align="center" width="120">
41-
<a href="https://github.com/syncfusion">
41+
<a href="https://www.syncfusion.com/blazor-components?utm_source=bunit&utm_medium=cpc&utm_campaign=bunit_blazor_bancy25">
4242
<img class="avatar" src="https://avatars.githubusercontent.com/u/1699795?s=460" width="72" height="72" alt="@syncfusion" />
4343
<br />
4444
Syncfusion

src/bunit.core/Rendering/TestRenderer.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,13 @@ private IRenderedComponentBase<TComponent> GetOrCreateRenderedComponent<TCompone
610610
{
611611
if (renderedComponents.TryGetValue(componentId, out var renderedComponent))
612612
{
613-
return (IRenderedComponentBase<TComponent>)renderedComponent;
613+
if (renderedComponent is IRenderedComponentBase<TComponent> typedComponent)
614+
{
615+
return typedComponent;
616+
}
617+
618+
renderedComponent.Dispose();
619+
renderedComponents.Remove(componentId);
614620
}
615621

616622
LoadRenderTreeFrames(componentId, framesCollection);

src/bunit.web/Rendering/BunitHtmlParser.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections;
22
using System.Diagnostics;
33
using AngleSharp;
4+
using AngleSharp.Css;
45
using AngleSharp.Dom;
56
using AngleSharp.Html.Parser;
67
using Bunit.Diffing;
@@ -28,7 +29,8 @@ public sealed class BunitHtmlParser : IDisposable
2829
/// with a AngleSharp context without a <see cref="TestRenderer"/> registered.
2930
/// </summary>
3031
public BunitHtmlParser()
31-
: this(Configuration.Default.WithCss().With(new HtmlComparer())) { }
32+
: this(Configuration.Default.WithCss()
33+
.With(new HtmlComparer())) { }
3234

3335
/// <summary>
3436
/// Initializes a new instance of the <see cref="BunitHtmlParser"/> class
@@ -43,7 +45,13 @@ public BunitHtmlParser(HtmlComparer htmlComparer, TestContextBase testContext)
4345

4446
private BunitHtmlParser(IConfiguration angleSharpConfiguration)
4547
{
46-
var config = angleSharpConfiguration.With(this);
48+
var config = angleSharpConfiguration
49+
.With(this)
50+
.WithRenderDevice(new DefaultRenderDevice
51+
{
52+
ViewPortWidth = 1920,
53+
ViewPortHeight = 1080,
54+
});
4755
context = BrowsingContext.New(config);
4856
var parseOptions = new HtmlParserOptions
4957
{

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ protected override void NavigateToCore(string uri, NavigationOptions options)
7575
var absoluteUri = GetNewAbsoluteUri(uri);
7676
var changedBaseUri = HasDifferentBaseUri(absoluteUri);
7777

78-
if (changedBaseUri)
79-
{
80-
BaseUri = GetBaseUri(absoluteUri);
81-
}
82-
83-
Uri = ToAbsoluteUri(uri).OriginalString;
84-
8578
if (options.ReplaceHistoryEntry && history.Count > 0)
8679
history.Pop();
8780

@@ -92,7 +85,6 @@ protected override void NavigateToCore(string uri, NavigationOptions options)
9285
testContextBase.Renderer.Dispatcher.InvokeAsync(() =>
9386
#endif
9487
{
95-
Uri = absoluteUri.OriginalString;
9688

9789
#if NET7_0_OR_GREATER
9890
var shouldContinueNavigation = false;
@@ -116,6 +108,12 @@ protected override void NavigateToCore(string uri, NavigationOptions options)
116108
history.Push(new NavigationHistory(uri, options));
117109
#endif
118110

111+
if (changedBaseUri)
112+
{
113+
BaseUri = GetBaseUri(absoluteUri);
114+
}
115+
116+
Uri = absoluteUri.OriginalString;
119117

120118
// Only notify of changes if user navigates within the same
121119
// base url (domain). Otherwise, the user navigated away
@@ -125,17 +123,13 @@ protected override void NavigateToCore(string uri, NavigationOptions options)
125123
{
126124
NotifyLocationChanged(isInterceptedLink: false);
127125
}
128-
else
129-
{
130-
BaseUri = GetBaseUri(absoluteUri);
131-
}
132126
});
133127
}
134128
#endif
135129

136130
#if NET7_0_OR_GREATER
137131
/// <inheritdoc/>
138-
protected override void SetNavigationLockState(bool value) {}
132+
protected override void SetNavigationLockState(bool value) { }
139133

140134
/// <inheritdoc/>
141135
protected override void HandleLocationChangingHandlerException(Exception ex, LocationChangingContext context)

tests/bunit.core.tests/Rendering/RenderModeTests.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
</ComponentWithChildContent>
169169
</ComponentWithChildContent>);
170170

171-
act.ShouldThrow<RenderModeMisMatchException>(); // todo: figure out good exception to use
171+
act.ShouldThrow<RenderModeMisMatchException>();
172172
}
173173
}
174174
@code{

tests/bunit.core.tests/TestDoubles/PersistentComponentState/FakePersistentComponentStateTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void Test013(string key)
6767
{
6868
var fakeState = this.AddFakePersistentComponentState();
6969

70-
fakeState.TryTake<string>(key, out var actual).ShouldBeFalse();
70+
fakeState.TryTake<string>(key, out _).ShouldBeFalse();
7171
}
7272

7373
[Fact(DisplayName = "TriggerOnPersisting triggers OnPersisting callbacks added to store")]

tests/bunit.testassets/BlazorE2E/AddRemoveChildComponents.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Child components follow.
1010

1111
@code {
1212
int numAdded = 0;
13-
List<string> currentChildrenMessages = new List<string>();
13+
private readonly List<string> currentChildrenMessages = new List<string>();
1414

1515
void AddChild()
1616
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div id="cool_beans" data-tab="@TabId">@TabId</div>
22

33
@code {
4-
string TabId = "17";
4+
private readonly string TabId = "17";
55
}

0 commit comments

Comments
 (0)