Releases: bUnit-dev/bUnit
1.13.5
This release contains a bunch of small tweaks and fixes.
1.12.6
Fixed
- The created HTML contained encoded strings. Reported by @tobiasbrandstaedter. Fixed by @linkdotnet.
1.11.7
Added
- Added the
StateFromJsonmethod to theNavigationHistorytype, to make it easy to deserialize navigation state stored as JSON during a call toNavigationManager.NavigateTo, e.g. as seen with the newInteractiveRequestOptionstype available in .NET 7. By @linkdotnet and @egil.
1.10.14
Added
-
Added new test double
FakeWebAssemblyHostEnvironmentthat implementsIWebAssemblyHostEnvironment. By @KristofferStrube. -
Added
Bindmethod to parameter builder that makes it easier to emulate the@bind-Valuesyntax in C#-based tests.When writing tests in razor files, the
@bind-directive can be directly applied like this:<MyComponent @bind-Value="myParam"></MyComponent>
The same expression in C# syntax is more verbose like this:
RenderComponent<MyComponent>(ps => ps .Add(c => c.Value, value) .Add(c => c.ValueChanged, newValue => value = newValue) .Add(c => c.ValueExpression, () => value));
With the new
Bindmethod this can be done in one method:RenderComponent<MyComponent>(ps => ps .Bind(c => c.Value, value, newValue => value = newValue, () => value));
By @linkdotnet and @egil.
-
Added support for
NavigationLock, which allows user code to intercept and prevent navigation. By @linkdotnet and @egil.
Fixed
JSInterop.VerifyInvokereported the wrong number of actual invocations of a given identifier. Reported by @otori. Fixed by @linkdotnet.
1.9.8
Changed
WaitForAssertionmethod is now marked as an assertion method with the[AssertionMethod]attribute. This makes certain analyzers like SonarSource's Tests should include assertions happy. By @egil.
Fixes
-
A race condition existed between
WaitForState/WaitForAssertionandFindComponents, if the first used the latter. Reported by @rmihael, @SviatoslavK, and @RaphaelMarcouxCTRL. Fixed by @egil and @linkdotnet. -
Triggering of event handlers now runs entirely inside the renderers synchronization context, avoiding race condition between elements in the DOM tree being updated by the renderer and the event triggering logic traversing the DOM tree to find event handlers to trigger. Reported by @FlukeFan. Fixed by @egil.
1.8.15
Added
- Added test helpers that make it much easier to pass files to the
InputFilecomponent. Learn more in the documentation. By @egil and @linkdotnet.
Changed
HtmlizerusesStringBuilderinstead ofList<string>to reduce allocations and improve render speed. By @linkdotnet.
Fixes
-
TestServiceProvidernow implementsIAsyncDisposable. This meansTestContext.Dispose()now calls the async disposable method as well as the non-async version on the service provider. It does however not block or await the task returned, since that can lead to deadlocks.To await the disposal of async services registered in the
TestContext.Servicescontainer, do the following:- Create a new type that derives from
TestContextand which implementIAsyncDisposable. - In the
DisposeAsync()method, callServices.DisposeAsync(). - Override the
Disposeand have it only callServices.Dispose().
- Create a new type that derives from
1.7.7
Added
-
Added method
SetAuthenticationTypetoTestAuthorizationContextto allow for custom authentication type checks. By @TimPurdum. -
Added
DisposeComponentstoTestContextBase. It will dispose and remove all components rendered by theTestContextBase. By @linkdotnet. -
Added .NET 7 as a target framework for bUnit. By @linkdotnet.
Fixed
-
Fixed step by step guide for building and viewing the documentation locally. By @linkdotnet.
-
FakeNavigationManager.NavigateTocould lead to exceptions when navigating to external url's. Reported by (@TDroogers)[https://github.com/TDroogers]. Fixed by @linkdotnet.
1.6.4
A quick minor release that primiarily fixes a regression in 1.5.12.
Fixed
ClickAsynccould lead to bubbling exceptions fromGetDispatchEventTaskseven though they should be handled. Reported by @aguacongas. Fixed by @linkdotnet.- Added more non bubbling events to bUnit so it behaves closer to the HTML specification. @linkdotnet.
1.5.12
This first release of 2022 includes one fix and four additions. A huge thank you to Steven Giesel (@linkdotnet) and Denis Ekart (@denisekart) for their contributions to this release.
Also a big shout out to bUnit's sponsors who helped make this release happen.
The higher tier sponsors are:
Other sponsors are:
- Hassan Rezk Habib (@hassanhabib)
- Jonny Larsson (@Garderoben)
- Domn Werner (@domn1995)
- Mladen Macanović (@stsrki)
- @ChristopheDEBOVE
- Steven Giesel (@linkdotnet)
Added
- Added
FakeSignOutSessionStateManagetype in Blazor, that makes it easy to test components that use theSignOutSessionStateManagetype. By @linkdotnet. - Added a validation to
AddChildContentmethod inComponentParameterCollectionBuilderthat will throw an exception if the component'sChildContentis a generic type. By @denisekart. - Added more optional arguments for
ClickandDoubleClickextensions which were introduced in .NET 5 and .NET 6. By @linkdotnet. - Added template support for
NunitandMSTestunit test frameworks. By @denisekart.
Fixed
- Changed
GetDispatchEventTasksfor bubbling events such that handled exceptions are not rethrown later from theWaitFor...helpers methods. Reported by @AndrewStrickland. Fixed by @linkdotnet
1.4.15
This release reintroduces Stub<TComponent> and related back into the main library, so the "preview" library bunit.web.mock is already obsolete.
Big shout out to bUnit's sponsors who helped make this release happen.
The higher tier sponsors are:
Other sponsors are:
- Hassan Rezk Habib (@hassanhabib)
- Jonny Larsson (@Garderoben)
- Domn Werner (@domn1995)
- Mladen Macanović (@stsrki)
- @ChristopheDEBOVE
Added
- Add
ComponentFactoriesextensions method that makes it easy to register an instance of a replacement component. By @egil. - Add ability to pass
ServiceProviderOptionstoTestServiceProviderthrough property to allow users to customize the service provider. By @rodolfograve.
Fixed
- Changed
SetParametersAndRendersuch that it rethrows any exceptions thrown by the component under testsSetParametersAsyncmethod. Thanks to @bonsall for reporting the issue. Fixed by @egil. onclickon a button inside a form will raise theonsubmitevent for the form itself. Reported by [@egil]. Fixed by @linkdotnet.- Only forms are allowed to have a
onsubmitevent handler. Whenonsubmitis invoked from a non-form element results in an exception. Fixed by @linkdotnet.