InputDate / InputNumber handling #502
-
Describe the bug We are observing a difference in behaviour when running BUnit tests from Visual Studio and This affects calling These work as expected in the Visual Studio Test Explorer. However, no value appears to be set on the
Example: <InputDate Class="form-control" id="delivery-date" @bind-Value="ViewModel.Item.DeliveryDate" /> With this test: var deliveryDateField = component.Find("#delivery-date");
deliveryDateField.Change("2021-09-20");
deliveryDateField.MarkupMatches("<input id=\"delivery-date\" type=\"date\" class=\"form-control\" value=\"2021-09-20\" >"); Results in this output:
Expected behavior: Expect the value of the Version info:
Additional context: We are working to identify a minimal reproduction. Any ideas on anything we can try would be appreciated. Adding |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @LordBenjamin, thanks for a well described issue. If there is an asynchronous re-render being triggered by var deliveryDateField = component.Find("#delivery-date");
deliveryDateField.Change("2021-09-20");
component.WaitForAssertion(() => deliveryDateField.MarkupMatches(@"<input id=""delivery-date"" type=""date"" class=""form-control modified valid"" value=""2021-09-20"" />"); Try this and let me know how it goes. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion @egil. |
Beta Was this translation helpful? Give feedback.
Hi @LordBenjamin, thanks for a well described issue.
If there is an asynchronous re-render being triggered by
Change
, then you might need to use WaitForAssertion, since that synchronizes between the render thread and the test thread. Learn more about it here: https://bunit.dev/docs/verification/async-assertionTry this and let me know how it goes.