bUnit-dev / bUnit

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.
https://bunit.dev
MIT License
1.11k stars 104 forks source link

Add ComponentParameterCollectionBuilder overloaded methods #1467

Closed Qwertyluk closed 2 months ago

Qwertyluk commented 3 months ago

Closes #751

note: I haven't updated CHANGELOG.md because I couldn't find an appropriate section for the changes for v2.

PR meta checklist

Code PR specific checklist

linkdotnet commented 3 months ago

Hey @Qwertyluk - thank you for the PR. The change itself looks good. I have two small amendments:

  1. Could you add a very small example with an explanation in the docs (https://bunit.dev/docs/providing-input/passing-parameters-to-components.html?tabs=csharp)? This will help also users why one would need such a function.
  2. Can you add your contribution in the CHANGELOG.md? Under the Unreleased section add another Added with a small text crediting you (I guess you will get the gist if you read some others).
egil commented 3 months ago

If you just update the changelog like Steven says, then our deployment will add the correct version tag next to it.

Qwertyluk commented 3 months ago

I've updated the changelog.

Though I haven't touched the documentation as I'm not sure if these changes are significant enough to require documentation updates. There was already an overloaded method ComponentParameterCollectionBuilder.Add that supports asynchronous callbacks and accepts Func<Task>. In this PR, I only added the ability to pass arguments for async callbacks so I have a feeling that mentioning these overloads might unnecessarily complicate the documentation. However, if you believe the documentation should be updated to include the support for asynchronous callback parameters, let me know and I'll make the necessary updates.

linkdotnet commented 2 months ago

Sorry for the delay. LGTM. Will run CI