A testing library for Blazor components. Get started testing Blazor components at https://bunit.dev
Hey, question, I'm trying to use bUnit from source, and also trying to use Microsoft.AspNetCore.Components
/ Microsoft.AspNetCore.Components.Web
from source, (because I'm debugging something)
However, when I point bUnit to the sources instead of the nuget, I'm getting loads of errors about missing namespaces from System.ComponentModel
: https://i.imgur.com/tDP8ld8.png
Anyone have an idea how to solve this? It kinda seems like I'm missing some implicit usings, because the namespaces aren't in the files either
context.RenderComponent<>();
with my component, it just throws a null reference exception without telling me anything useful. Something in my component is null. I was trying to see if I can add a fix somewhere to tell me exactly what is null, if that's possible. The exception is being thrown from somewhere inside base.ProcessPendingRender();
alright sure. I think it's pretty easy to reproduce. You kinda just have to make a .razor file throw a null reference exception. Maybe you have bind null to something that's not expecting it, but that's it.
in my project I made a null check helper extension which is like this public static bool IsNull(this object input, [CallerArgumentExpression("input")] string message = null, [CallerMemberName] string caller = "")
and actually tells you which expression threw the null exception. Was hoping I could add something similar in whatever is throwing that null exception during rendering
@ref
.
<input class="mud-input-slot mud-input-root mud-input-root-text mud-input-root-adorned-end mud-input-root-margin-dense mud-select-input" type="text" value="ABC" blazor:oninput="2" blazor:onchange="3" readonly="" blazor:onblur="4" inputmode="text" blazor:onkeydown="5" blazor:onkeypress="6" blazor:onkeyup="7" maxlength="524288" blazor:elementreference="">
<input class="mud-input-slot mud-input-root mud-input-root-text mud-input-root-adorned-end mud-input-root-margin-dense mud-select-input" type="text" value="Yes" blazor:oninput="2" blazor:onchange="3" readonly="" blazor:onblur="4" inputmode="text" blazor:onkeydown="5" blazor:onkeypress="6" blazor:onkeyup="7" maxlength="524288" blazor:elementreference="">
regardless of true or false it is showing readonly=""
Hello. I thought I'd join the chat, as I'm using BUnit and really liking it. I have and I'm going to have questions/general thoughts. I should buy you a coffee, Egil, if it's not too expensive in Iceland!
One thing that I think would be useful and something that I am happy to contribute to is the documentation around how to use event handlers with some basic types and then how to check results. I found myself struggling with checking the state of the HTML after a change. I can use var cut = ctx.RenderComponent<HelloWorld>() and check cut.Markup but after an event click on a radio button, cut.Markup is still the same, and I'm not sure what is the best way to get the revised Markup (this may just be that I am missing something).