Setting render mode #1823
Unanswered
travis-practiceprofiles
asked this question in
Q&A
Replies: 1 comment 10 replies
-
|
Hey @travis-practiceprofiles - can you send the component under test and the test itself? bUnit - strictly speaking - doesn't adhere directly to your rendermode in your |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I've got a project that uses server-side rendering. When bUnit renders components for this project, I get an error reading, "System.InvalidOperationException : JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method."
I am aware that the solution to this is supposed to be to render using an appropriate render mode (in this case RenderMode.InteractiveServer), and the bUnit documentation addresses this issue here: https://bunit.dev/docs/interaction/render-modes.html?tabs=csharp
However, that documentation seems to be very out of date. It uses RenderComponent, instead of the unified Render function from the bunit 2 release, and also references TestContext which has been replaced by BunitContext. Neither SetRendererInfo nor SetAssignedRenderMode seem to exist in recent versions of bUnit. I have tried using older versions of bUnit, but so far I have not found a version that includes those functions.
So, what is the method that should be used to control component (or page) rendering during testing under the current release of bunit? (And perhaps the documentation should say which version of bUnit it applies to, if not the current version?)
Beta Was this translation helpful? Give feedback.
All reactions