Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
input, and `patch_svg` on synthetic 200- and 1000-path SVGs.
- Stress tests: 5000-deep nesting, 2000-attribute element,
~470KB synthetic SVG patching, 9KB metacharacter round-trip parity,
MIME show round-trip parity.
and one canonical fixture pinned across `MIME"text/html"`,
`MIME"text/plain"`, and `html_response(...).body`.
- `precompile()` block in the module top so the first `render(...)` in
a user's session doesn't pay JIT cost for the common shapes.

Expand Down
21 changes: 21 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,27 @@ using HyperSignal: div, select, summary
@test String(take!(io)) == "<b>x</b>"
end

@testset "one fixture stays byte-stable across text/html, text/plain, and HTTP.Response sinks" begin
# Why: these are the three places callers actually consume a
# HyperSignal value — notebook display, REPL/plain-text display,
# and an HTTP response body. One canonical fixture should say they
# all agree on the rendered bytes.
el = div(class="card", h2("Hi"), p("a < b"))
html = render(el)

html_io = IOBuffer()
show(html_io, MIME"text/html"(), el)
@test String(take!(html_io)) == html

plain_io = IOBuffer()
show(plain_io, MIME"text/plain"(), el)
@test String(take!(plain_io)) == "HyperSignal.Element: " * html

resp = html_response(el)
@test resp.body == codeunits(html)
@test String(resp.body) == html
end

@testset "patch_svg with CairoMakie figure renders + namespaces collision-safely" begin
# Why: prove the front-row CairoMakie story actually works end-to-end
# — produce a real figure, run it through inline_svg, drop two of
Expand Down