livebook/test/live_book_web/utils_test.exs
Jonatan Kłosko a8b5227dd6
Use inspect to highlight cell result (#18)
* Use inspect to highlight cell result

* Use invalid UTF-8 byte for color separation

* Match editor typography in cell output
2021-02-03 13:13:56 +01:00

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">&quot;1 &lt; 2&quot;</span>}} ==
Utils.inspect_as_html("1 < 2")
end
end
end