Renders element trees (or whole apps) to buffers and text snapshots without
touching the terminal. The Tuix analog of OpenTUI's createTestRenderer.
Example
element =
box border: :single, width: 12, height: 3 do
text("hi")
end
assert Tuix.TestRenderer.render_to_text(element, 20, 5) == """
┌──────────┐
│hi │
└──────────┘
""" |> String.trim_trailing()
Summary
Functions
Renders an element tree or app module at the given size, returning the
Tuix.Buffer for structured assertions (cell styles, etc).
Renders to a plain-text snapshot: one string per row joined with newlines, trailing whitespace trimmed.
Functions
@spec render(Tuix.Element.t() | module(), pos_integer(), pos_integer(), keyword()) :: Tuix.Buffer.t()
Renders an element tree or app module at the given size, returning the
Tuix.Buffer for structured assertions (cell styles, etc).
@spec render_to_text( Tuix.Element.t() | module(), pos_integer(), pos_integer(), keyword() ) :: String.t()
Renders to a plain-text snapshot: one string per row joined with newlines, trailing whitespace trimmed.