bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.
@formname
directive led to an InvalidOperationException
when used on a form element. Reported by @suzu2469 in #1438.
Fixed by @egil/@linkdotnet.NavigationManager
is again registered as a singleton instead of scoped.IKeyedServiceProvider
in net8.0. Reported by @ViRuSTriNiTy. By @linkdotnet.net9.0
. NOTE, there is no commitment as of now to support net9.0 in bUnit v1. However. Support for net9.0 may move to a future v2 release of bUnit and be deprecated in v1. However, allowing bUnit to build and work with net9.0 previews allows our users to keep testing!SupplyFromQueryParameter
in net8.0. Reported by @aayjaychan. Fixed by @egil and @linkdotnet.TestContext
was disposed, the Blazor Renderer itself didn't dispose components under test. By @linkdotnet.HistoryEntryState
on NavigationManager
will be populated. By @linkdotnet.IRenderedFragmentBase.InvokeAsync
that allow retrieving the work item's return value. By @jcparkyn.TestContext
was disposed, it disposed of all services via the service provider. However, if there were ongoing renders happening, this could cause inconsistent state in the render tree, since the TestRenderer
could try to access the service provider to instantiate components.IAsyncDisposable
is now also awaited. Fixed by @egil and @linkdotnet. Reported by @BenSchoen in https://github.com/bUnit-dev/bUnit/issues/1227.Support for custom service provider factories (IServiceProviderFactory<TContainerBuilder>
). This enables the use of Autofac and other frameworks for dependency injection like on real-world ASP.NET Core / Blazor projects. By @inf9144.
Ability to raise the oncancel
and onclose
event, that was introduced with .NET 8.
SetParametersAndRender
, the method could return before the parameters were set and the component under test had finished rendering. This was a regression that happened in v1.21.9. Reported by @Skintkingle in https://github.com/bUnit-dev/bUnit/issues/1188. Fixed by @egil.net8.0
supportWaitForAssertion
to infinite when a debugger is attached. By @linkdotnet.IRenderedFragment.Find
. Reported by a2er. Fixed by @linkdotnet.Calling MarkupMatches(RenderFragment)
from a lambda passed to e.g. WaitForAssertion
could lead to a deadlock in certain circumstances. Fixed by @linkdotnet. Reported by @uecasm in https://github.com/bUnit-dev/bUnit/issues/1143.
Rendering complex component hierarchies could result in a stack overflow. Fixed by @egil.. Reported by @groogiam in https://github.com/bUnit-dev/bUnit/issues/1064.
Remove capturing and dispatching markup updates to test frameworks synchronization context again. This could cause deadlocks and does not have any impact on test stability. Fixed by @egil. Reported by @biohazard999 in https://github.com/bUnit-dev/bUnit/issues/1144.
Allow using 3rd party IComponentActivator
at the same time as component factories. By @egil. Reported by BenSchoen in https://github.com/bUnit-dev/bUnit/issues/1129.
Calling IRenderedComponent.Render()
or IRenderedComponent.SetParametersAndRender()
did not batch up multiple synchronous re-renders after setting parameters. This is now changed such that the method causes the component to re-render with new parameters in the same way as if a parent component had passed new parameters to it. By @egil. Reported by @Jcparkyn in https://github.com/bUnit-dev/bUnit/issues/1119.
DefaultWaitTimeout
property to TestContext
to enable overriding the default timeout of "wait for" methods like WaitForAssertion
from 1 second to something else. By @egil.ObjectDisposedException
if any methods is accessed after it has been disposed. It will also prevent changes to the internal render tree after it has been disposed. By @egil.ArgumentException
with MarkupMatches
. Reported by @candritzky. Fixed by @linkdotnet.