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.14k stars 105 forks source link

Not setting event type by default #780

Open egil opened 2 years ago

egil commented 2 years ago

In the latest version of Blazor E2E tests, the KeyPressEventComponent expects the event onkeypress to be listed as keypress in KeyboardEventArgs.Type.

I think bUnit should set it automatically for the user in the EventDispatchExtensions methods, unless the user explicitly provides a different value.

Thoughts?

linkdotnet commented 2 years ago

Hmm given that it is deprecated and type seems to be always "keypress", we wouldn't bother anyone with the changed logic.

I am really neutral on this one, as I don't see any harm but also not much gain :D

egil commented 2 years ago

Interesting. My approach is more that we should be consistent with what Blazor does "in production", even if that's not how things are supposed to be.

But I guess this is more a "figure out what Blazor does" assignment in the first place.

linkdotnet commented 2 years ago

Interesting. My approach is more that we should be consistent with what Blazor does "in production", even if that's not how things are supposed to be.

But I guess this is more a "figure out what Blazor does" assignment in the first place.

Is this something Blazor does or the Browser?

egil commented 2 years ago

Interesting. My approach is more that we should be consistent with what Blazor does "in production", even if that's not how things are supposed to be.

But I guess this is more a "figure out what Blazor does" assignment in the first place.

Is this something Blazor does or the Browser?

Their e2e would blow up if they didn't, so I assume so.