Documentation
¶
Index ¶
- type TestRenderer
- func (r *TestRenderer) GetCurrentVDOM() *vdom.VNode
- func (r *TestRenderer) Navigate(path string) error
- func (r *TestRenderer) ReRender()
- func (r *TestRenderer) ReRenderSlot(slotParent runtime.Component) error
- func (r *TestRenderer) RenderChild(key string, child runtime.Component) *vdom.VNode
- func (r *TestRenderer) RenderRoot() *vdom.VNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestRenderer ¶
type TestRenderer struct {
// contains filtered or unexported fields
}
TestRenderer is a minimal test harness that implements runtime.Renderer for in-memory testing without browser or WASM dependencies.
It captures VDOM output from component renders and allows tests to: - Attach components to the renderer - Trigger re-renders via StateHasChanged() - Inspect the resulting VDOM tree
func NewTestRenderer ¶
func NewTestRenderer(comp runtime.Component) *TestRenderer
NewTestRenderer creates a test renderer attached to the given component.
func (*TestRenderer) GetCurrentVDOM ¶
func (r *TestRenderer) GetCurrentVDOM() *vdom.VNode
GetCurrentVDOM returns the most recently rendered VDOM tree. Tests use this to inspect the component's output after renders.
func (*TestRenderer) Navigate ¶
func (r *TestRenderer) Navigate(path string) error
Navigate is a no-op implementation for tests. Most tests don't need navigation functionality.
func (*TestRenderer) ReRender ¶
func (r *TestRenderer) ReRender()
ReRender performs a re-render of the component. This is called by StateHasChanged() when the component requests a re-render.
func (*TestRenderer) ReRenderSlot ¶
func (r *TestRenderer) ReRenderSlot(slotParent runtime.Component) error
ReRenderSlot patches only the BodyContent slot of a layout. For tests, this simply re-renders the slot parent component.
func (*TestRenderer) RenderChild ¶
RenderChild is a stub for child component rendering. For simple data binding tests, we typically won't have child components. If needed in the future, this can be expanded to track child instances.
func (*TestRenderer) RenderRoot ¶
func (r *TestRenderer) RenderRoot() *vdom.VNode
RenderRoot performs the initial render of the component. This should be called at the start of a test to get the initial VDOM.