Skip to content

Commit 8c58c1e

Browse files
authored
Merge pull request #643 from bUnit-dev/release/v1.6
Release of new minor version v1.6
2 parents 01b7081 + 0461afb commit 8c58c1e

File tree

9 files changed

+78
-10
lines changed

9 files changed

+78
-10
lines changed

CHANGELOG.md

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

77
## [Unreleased]
88

9+
A quick minor release that primiarily fixes a regression in 1.5.12.
10+
11+
### Fixed
12+
13+
- `ClickAsync` could lead to bubbling exceptions from `GetDispatchEventTasks` even though they should be handled. Reported by [@aguacongas](aguacongas). Fixed by [@linkdotnet](https://github.com/linkdotnet).
14+
- Added more non bubbling events to bUnit so it behaves closer to the HTML specification. [@linkdotnet](https://github.com/linkdotnet).
15+
916
## [1.5.12] - 2022-02-15
1017

11-
This first release of 2022 includes a one fix and four additions. A huge thank you to [Steven Giesel (@linkdotnet)](https://github.com/linkdotnet) and [Denis Ekart (@denisekart)](https://github.com/denisekart) for their contributions to this release.
18+
This first release of 2022 includes one fix and four additions. A huge thank you to [Steven Giesel (@linkdotnet)](https://github.com/linkdotnet) and [Denis Ekart (@denisekart)](https://github.com/denisekart) for their contributions to this release.
1219

1320
Also a big shout out to **bUnit's sponsors** who helped make this release happen.
1421

@@ -20,11 +27,12 @@ Also a big shout out to **bUnit's sponsors** who helped make this release happen
2027

2128
**Other sponsors are:**
2229

23-
- [Hassan Rezk Habib (@Garderoben)](https://github.com/hassanhabib)
30+
- [Hassan Rezk Habib (@hassanhabib)](https://github.com/hassanhabib)
2431
- [Jonny Larsson (@Garderoben)](https://github.com/Garderoben)
2532
- [Domn Werner (@domn1995)](https://github.com/domn1995)
2633
- [Mladen Macanović (@stsrki)](https://github.com/stsrki)
2734
- [@ChristopheDEBOVE](https://github.com/ChristopheDEBOVE)
35+
- [Steven Giesel (@linkdotnet)](https://github.com/linkdotnet)
2836

2937
### Added
3038

@@ -41,6 +49,22 @@ Also a big shout out to **bUnit's sponsors** who helped make this release happen
4149

4250
This release reintroduces `Stub<TComponent>` and related back into the main library, so the "preview" library `bunit.web.mock` is already obsolete.
4351

52+
A big shout out to **bUnit's sponsors** who helped make this release happen.
53+
54+
**The higher tier sponsors are:**
55+
56+
- [Progress Telerik](https://github.com/Progress-Telerik)
57+
- [Syncfusion](https://github.com/syncfusion)
58+
- [CTRL Informatique](https://github.com/CTRL-Informatique)
59+
60+
**Other sponsors are:**
61+
62+
- [Hassan Rezk Habib (@hassanhabib)](https://github.com/hassanhabib)
63+
- [Jonny Larsson (@Garderoben)](https://github.com/Garderoben)
64+
- [Domn Werner (@domn1995)](https://github.com/domn1995)
65+
- [Mladen Macanović (@stsrki)](https://github.com/stsrki)
66+
- [@ChristopheDEBOVE](https://github.com/ChristopheDEBOVE)
67+
4468
### Added
4569

4670
- Add `ComponentFactories` extensions method that makes it easy to register an instance of a replacement component. By [@egil](https://github.com/egil).
@@ -65,7 +89,7 @@ Big shout out to **bUnit's sponsors** who helped make this release happen.
6589

6690
**Other sponsors are:**
6791

68-
- [Hassan Rezk Habib (@Garderoben)](https://github.com/hassanhabib)
92+
- [Hassan Rezk Habib (@hassanhabib)](https://github.com/hassanhabib)
6993
- [Jonny Larsson (@Garderoben)](https://github.com/Garderoben)
7094
- [Domn Werner (@domn1995)](https://github.com/domn1995)
7195
- [Mladen Macanović (@stsrki)](https://github.com/stsrki)

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<!-- Shared code analyzers used for all projects in the solution -->
4848
<ItemGroup Label="Code Analyzers">
4949
<PackageReference Include="AsyncFixer" Version="1.5.1" PrivateAssets="All" />
50-
<PackageReference Include="Meziantou.Analyzer" Version="1.0.694" PrivateAssets="All" />
50+
<PackageReference Include="Meziantou.Analyzer" Version="1.0.695" PrivateAssets="All" />
5151
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.35.0.42613" PrivateAssets="All" />
5252
</ItemGroup>
5353

src/bunit.core/Rendering/TestRenderer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,17 @@ public Task DispatchEventAsync(
8282
}
8383
catch (ArgumentException ex) when (string.Equals(ex.Message, $"There is no event handler associated with this event. EventId: '{eventHandlerId}'. (Parameter 'eventHandlerId')", StringComparison.Ordinal))
8484
{
85+
if (ignoreUnknownEventHandlers)
86+
{
87+
return Task.CompletedTask;
88+
}
89+
8590
var betterExceptionMsg = new UnknownEventHandlerIdException(eventHandlerId, fieldInfo, ex);
8691
return Task.FromException(betterExceptionMsg);
8792
}
8893
});
8994

90-
if (result.IsFaulted && result.Exception is not null && !(ignoreUnknownEventHandlers && result.Exception.InnerException is UnknownEventHandlerIdException))
95+
if (result.IsFaulted && result.Exception is not null)
9196
{
9297
HandleException(result.Exception);
9398
}

src/bunit.web/EventDispatchExtensions/TriggerEventDispatchExtensions.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,31 @@ namespace Bunit;
1111
/// </summary>
1212
public static class TriggerEventDispatchExtensions
1313
{
14-
private static readonly HashSet<string> NonBubblingEvents = new(StringComparer.Ordinal) { "onabort", "onblur", "onchange", "onerror", "onfocus", "onload", "onloadend", "onloadstart", "onmouseenter", "onmouseleave", "onprogress", "onreset", "onscroll", "onsubmit", "onunload", "ontoggle", "ondomnodeinsertedintodocument", "ondomnoderemovedfromdocument" };
14+
private static readonly HashSet<string> NonBubblingEvents = new(StringComparer.Ordinal)
15+
{
16+
"onabort",
17+
"onblur",
18+
"onchange",
19+
"onerror",
20+
"onfocus",
21+
"onload",
22+
"onloadend",
23+
"onloadstart",
24+
"onmouseenter",
25+
"onmouseleave",
26+
"onprogress",
27+
"onreset",
28+
"onscroll",
29+
"onsubmit",
30+
"onunload",
31+
"ontoggle",
32+
"ondomnodeinsertedintodocument",
33+
"ondomnoderemovedfromdocument",
34+
"oninvalid",
35+
"onpointerleave",
36+
"onpointerenter",
37+
"onselectionchange",
38+
};
1539
private static readonly HashSet<string> DisabledEventNames = new(StringComparer.Ordinal) { "onclick", "ondblclick", "onmousedown", "onmousemove", "onmouseup" };
1640

1741
/// <summary>

src/bunit.web/bunit.web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="AngleSharp" Version="0.16.1" />
19-
<PackageReference Include="AngleSharp.Css" Version="0.16.3" />
19+
<PackageReference Include="AngleSharp.Css" Version="0.16.4" />
2020
<PackageReference Include="AngleSharp.Diffing" Version="0.17.0" />
2121
<PackageReference Include="AngleSharp.Wrappers" Version="2.0.0" />
2222
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.255" PrivateAssets="All" />

tests/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<ItemGroup Condition="$(MSBuildProjectName) != 'bunit.testassets'">
1616
<PackageReference Include="AutoFixture" Version="4.17.0" />
1717
<PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
19-
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
19+
<PackageReference Include="GitHubActionsTestLogger" Version="1.3.0" />
2020
<PackageReference Include="Moq" Version="4.16.1" />
2121
<PackageReference Include="Shouldly" Version="4.0.3" />
2222
<PackageReference Include="xunit" Version="2.4.1" />

tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,4 +598,15 @@ public void CanHandleRemovedParentObjects()
598598
cut.WaitForState(() => !cut.FindAll("div").Any());
599599
cut.FindAll("div").Count.ShouldBe(0);
600600
}
601+
602+
[Fact]
603+
public async Task CanHandleRemovedParentObjectsAsync()
604+
{
605+
var cut = RenderComponent<DispatcherException>();
606+
607+
await cut.Find("button").ClickAsync(new MouseEventArgs());
608+
609+
cut.WaitForState(() => !cut.FindAll("div").Any());
610+
cut.FindAll("div").Count.ShouldBe(0);
611+
}
601612
}

tests/bunit.web.tests/EventDispatchExtensions/GeneralEventDispatchExtensionsTest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public void Test101()
9494
[InlineData("ontoggle")]
9595
[InlineData("onDOMNodeInsertedIntoDocument")]
9696
[InlineData("onDOMNodeRemovedFromDocument")]
97+
[InlineData("oninvalid")]
98+
[InlineData("onpointerleave")]
99+
[InlineData("onpointerenter")]
100+
[InlineData("onselectionchange")]
97101
public async Task Test110(string eventName)
98102
{
99103
var cut = RenderComponent<EventBubbles>(ps => ps.Add(p => p.EventName, eventName));

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "1.5",
3+
"version": "1.6",
44
"assemblyVersion": {
55
"precision": "revision"
66
},

0 commit comments

Comments
 (0)