mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-13 00:14:33 +08:00
* Use inspect to highlight cell result * Use invalid UTF-8 byte for color separation * Match editor typography in cell output
20 lines
625 B
Elixir
20 lines
625 B
Elixir
defmodule LiveBookWeb.UtilsTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias LiveBookWeb.Utils
|
|
|
|
doctest Utils
|
|
|
|
describe "inspect_as_html/2" do
|
|
test "uses span tags for term highlighting" do
|
|
assert {:safe,
|
|
~s{<span class="list">[</span><span class="number">1</span><span class="list">,</span> <span class="number">2</span><span class="list">]</span>}} ==
|
|
Utils.inspect_as_html([1, 2])
|
|
end
|
|
|
|
test "escapes HTML in the inspect result" do
|
|
assert {:safe, ~s{<span class="string">"1 < 2"</span>}} ==
|
|
Utils.inspect_as_html("1 < 2")
|
|
end
|
|
end
|
|
end
|