Utilities for building test fixtures and mock trees without manual TreeNode construction.
Examples
# Simple node
node = AshSDUI.Mock.tree_node("Card@v1")
# Node with children
parent = AshSDUI.Mock.tree_node("Panel@v1", children: [
AshSDUI.Mock.tree_node("Header@v1"),
AshSDUI.Mock.tree_node("Body@v1")
])
# From a resource
tree = AshSDUI.Mock.from_resource(MyApp.Player, subject_id: "player-42")
Summary
Functions
Builds a TreeNode from a resource with SDUI annotation.
Builds a TreeNode with sensible defaults.
Functions
Builds a TreeNode from a resource with SDUI annotation.
Reads :default_component from the resource's sdui block and wraps it in a TreeNode
pointing to the resource as the subject.
Options
:subject_id— string record ID, default"first":component_name— override the resource's default component name
Raises
ArgumentErrorif resource has no:default_componentand:component_nameis not passed
Builds a TreeNode with sensible defaults.
Options
:id— UUID string, generated if omitted:static_props— map, default%{}:subject_resource— string resource name, optional:subject_id— string record ID, optional:region— atom region name, default:default:order— non-negative integer, default0:children— list of TreeNode structs, default[]