Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LV >= 0.20.10 #3

Closed
wants to merge 8 commits into from
Closed
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
18 changes: 8 additions & 10 deletions lib/surface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
indentation = meta[:indentation] || 0
column = meta[:column] || 1

debug_annotations? = Module.get_attribute(__CALLER__.module, :__debug_annotations__)
component_type = Module.get_attribute(__CALLER__.module, :component_type)

string
Expand All @@ -123,7 +122,7 @@
file: __CALLER__.file,
line: line,
caller: __CALLER__,
annotate_content: debug_annotations? && (&Phoenix.LiveView.HTMLEngine.annotate_tagged_content/1)
annotate_content: annotate_content()
)
end

Expand Down Expand Up @@ -174,19 +173,12 @@

@doc false
def __compile_sface__(name, file, env) do
debug_annotations? =
Module.get_attribute(
env.module,
:__debug_annotations__,
Application.get_env(:phoenix_live_view, :debug_heex_annotations, false)
)

file
|> File.read!()
|> Surface.Compiler.compile(1, env, file)
|> Surface.Compiler.to_live_struct(
caller: %Macro.Env{env | file: file, line: 1, function: {String.to_atom(name), 1}},
annotate_content: debug_annotations? && (&Phoenix.LiveView.HTMLEngine.annotate_tagged_content/1)
annotate_content: annotate_content()
)
end

Expand Down Expand Up @@ -504,4 +496,10 @@
{root_prop.name, value}
end
end

defp annotate_content do
Code.ensure_loaded?(Phoenix.LiveView.HTMLEngine) &&
function_exported?(Phoenix.LiveView.HTMLEngine, :annotate_body, 1) &&
(&Phoenix.LiveView.HTMLEngine.annotate_body/1)

Check warning on line 503 in lib/surface.ex

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.13.4 | Erlang/OTP 24.0)

Phoenix.LiveView.HTMLEngine.annotate_body/1 is undefined or private
end
end
11 changes: 6 additions & 5 deletions lib/surface/compiler/eex_engine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ defmodule Surface.Compiler.EExEngine do
end

defp maybe_annotate_content(nodes, annotate_content, caller) do
if annotate_content do
{before_comment, after_comment} = annotate_content.(caller)
[%AST.Literal{value: before_comment}] ++ nodes ++ [%AST.Literal{value: after_comment}]
else
nodes
case annotate_content && annotate_content.(caller) do
{before_comment, after_comment} ->
[%AST.Literal{value: before_comment}] ++ nodes ++ [%AST.Literal{value: after_comment}]

_ ->
nodes
end
end

Expand Down
7 changes: 4 additions & 3 deletions lib/surface/renderer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
|> Map.put(:function, {:render, 1})
|> Map.put(:file, template)

debug_annotations? = Module.get_attribute(__CALLER__.module, :__debug_annotations__)

template
|> File.read!()
|> Surface.Compiler.compile(1, env, template)
|> Surface.Compiler.to_live_struct(
caller: env,
annotate_content: debug_annotations? && (&Phoenix.LiveView.HTMLEngine.annotate_tagged_content/1)
annotate_content:
Code.ensure_loaded?(Phoenix.LiveView.HTMLEngine) &&
function_exported?(Phoenix.LiveView.HTMLEngine, :annotate_body, 1) &&
(&Phoenix.LiveView.HTMLEngine.annotate_body/1)

Check warning on line 26 in lib/surface/renderer.ex

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.13.4 | Erlang/OTP 24.0)

Phoenix.LiveView.HTMLEngine.annotate_body/1 is undefined or private
)
else
nil
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Surface.MixProject do

defp deps do
[
{:phoenix_live_view, "~> 0.19.0 or ~> 0.20.0"},
{:phoenix_live_view, "~> 0.19.0 or ~> 0.20.10"},
{:sourceror, "~> 1.0.0"},
{:jason, "~> 1.0", only: :test},
{:floki, "~> 0.35", only: :test},
Expand Down
18 changes: 9 additions & 9 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
%{
"castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"},
"castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727", [:mix], [], "hexpm", "374c6e7ca752296be3d6780a6d5b922854ffcc74123da90f2f328996b962d33a"},
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
"ex_doc": {:hex, :ex_doc, "0.31.1", "8a2355ac42b1cc7b2379da9e40243f2670143721dd50748bf6c3b1184dae2089", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3178c3a407c557d8343479e1ff117a96fd31bafe52a039079593fb0524ef61b0"},
"floki": {:hex, :floki, "0.35.4", "cc947b446024732c07274ac656600c5c4dc014caa1f8fb2dfff93d275b83890d", [:mix], [], "hexpm", "27fa185d3469bd8fc5947ef0f8d5c4e47f0af02eb6b070b63c868f69e3af0204"},
"ex_doc": {:hex, :ex_doc, "0.31.2", "8b06d0a5ac69e1a54df35519c951f1f44a7b7ca9a5bb7a260cd8a174d6322ece", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "317346c14febaba9ca40fd97b5b5919f7751fb85d399cc8e7e8872049f37e0af"},
"floki": {:hex, :floki, "0.36.1", "712b7f2ba19a4d5a47dfe3e74d81876c95bbcbee44fe551f0af3d2a388abb3da", [:mix], [], "hexpm", "21ba57abb8204bcc70c439b423fc0dd9f0286de67dc82773a14b0200ada0995f"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.4", "29563475afa9b8a2add1b7a9c8fb68d06ca7737648f28398e04461f008b69521", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f4ed47ecda66de70dd817698a703f8816daa91272e7e45812469498614ae8b29"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.5", "e0ff5a7c708dda34311f7522a8758e23bfcd7d8d8068dc312b5eb41c6fd76eba", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "94d2e986428585a21516d7d7149781480013c56e30c6a233534bedf38867a59a"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"phoenix": {:hex, :phoenix, "1.7.11", "1d88fc6b05ab0c735b250932c4e6e33bfa1c186f76dcf623d8dd52f07d6379c7", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "b1ec57f2e40316b306708fe59b92a16b9f6f4bf50ccfa41aa8c7feb79e0ec02a"},
"phoenix_html": {:hex, :phoenix_html, "4.0.0", "4857ec2edaccd0934a923c2b0ba526c44a173c86b847e8db725172e9e51d11d6", [:mix], [], "hexpm", "cee794a052f243291d92fa3ccabcb4c29bb8d236f655fb03bcbdc3a8214b8d13"},
"phoenix_live_view": {:hex, :phoenix_live_view, "0.20.9", "46d5d436d3f8ff97f066b6c45528fd842a711fd3875b2d3f706b2e769ea07c51", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "694388615ece21b70c523910cba1c633132b08a270caaf60100dd4eaf331885d"},
"phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"},
"phoenix_live_view": {:hex, :phoenix_live_view, "0.20.14", "70fa101aa0539e81bed4238777498f6215e9dda3461bdaa067cad6908110c364", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "82f6d006c5264f979ed5eb75593d808bbe39020f20df2e78426f4f2d570e2402"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"},
"phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"},
"plug": {:hex, :plug, "1.15.3", "712976f504418f6dff0a3e554c40d705a9bcf89a7ccef92fc6a5ef8f16a30a97", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cc4365a3c010a56af402e0809208873d113e9c38c401cabd88027ef4f5c01fd2"},
"plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"},
"sourceror": {:hex, :sourceror, "1.0.1", "ec2c41726d181adce888ac94b3f33b359a811b46e019c084509e02c70042e424", [:mix], [], "hexpm", "28225464ffd68bda1843c974f3ff7ccef35e29be09a65dfe8e3df3f7e3600c57"},
"sourceror": {:hex, :sourceror, "1.0.2", "c5e86fdc14881f797749d1fe5df017ca66727a8146e7ee3e736605a3df78f3e6", [:mix], [], "hexpm", "832335e87d0913658f129d58b2a7dc0490ddd4487b02de6d85bca0169ec2bd79"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
"websock_adapter": {:hex, :websock_adapter, "0.5.5", "9dfeee8269b27e958a65b3e235b7e447769f66b5b5925385f5a569269164a210", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "4b977ba4a01918acbf77045ff88de7f6972c2a009213c515a445c48f224ffce9"},
"websock_adapter": {:hex, :websock_adapter, "0.5.6", "0437fe56e093fd4ac422de33bf8fc89f7bc1416a3f2d732d8b2c8fd54792fe60", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "e04378d26b0af627817ae84c92083b7e97aca3121196679b73c73b99d0d133ea"},
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Note this file is intentionally a .exs file because it is loaded
# in the test helper with phoenix_live_view debug_heex_annotations turned on.
defmodule Surface.CompilerTest.DebugAnnotations do
import Surface.CompilerTest.DebugAnnotationsUtil

use_component()
use Surface.Component

def func_with_tag(assigns) do
~F[<div>func_with_tag</div>]
Expand Down
12 changes: 0 additions & 12 deletions test/support/debug_annotations_util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,4 @@ defmodule Surface.CompilerTest.DebugAnnotationsUtil do
|> Version.parse!()
|> Version.compare("0.20.0") != :lt
end

defmacro use_component() do
if __MODULE__.debug_heex_annotations_supported?() do
quote do
use Surface.Component, debug_heex_annotations: true
end
else
quote do
use Surface.Component
end
end
end
end
16 changes: 8 additions & 8 deletions test/surface/compiler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_tag> test/support/debug_annotations.ex:7 --><div>func_with_tag</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_tag> -->
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_tag> test/support/debug_annotations.exs:7 () --><div>func_with_tag</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_tag> -->
</div>
"""
end
Expand All @@ -858,7 +858,7 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_multiple_root_tags> test/support/debug_annotations.ex:21 --><div>text 1</div><div>text 2</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_multiple_root_tags> -->
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_multiple_root_tags> test/support/debug_annotations.exs:21 () --><div>text 1</div><div>text 2</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_multiple_root_tags> -->
</div>
"""
end
Expand All @@ -875,7 +875,7 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_only_text> test/support/debug_annotations.ex:11 -->only_text<!-- </Surface.CompilerTest.DebugAnnotations.func_with_only_text> -->
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_only_text> test/support/debug_annotations.exs:11 () -->only_text<!-- </Surface.CompilerTest.DebugAnnotations.func_with_only_text> -->
</div>
"""
end
Expand All @@ -894,12 +894,12 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_tag> test/support/debug_annotations.ex:7 --><div>func_with_tag</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_tag> -->
<!-- <Surface.CompilerTest.DebugAnnotations.func_with_tag> test/support/debug_annotations.exs:7 () --><div>func_with_tag</div><!-- </Surface.CompilerTest.DebugAnnotations.func_with_tag> -->
</div>
"""
end

test "show debug info for module components with a colocated sface file and point to line 1" do
test "show debug info for module components with a colocated sface file and point to line 3" do
alias Surface.CompilerTest.DebugAnnotations

html =
Expand All @@ -914,8 +914,8 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.render> test/support/debug_annotations.sface:1 -->render<!-- </Surface.CompilerTest.DebugAnnotations.render> -->
<!-- <Surface.CompilerTest.DebugAnnotations.render> test/support/debug_annotations.sface:1 -->render<!-- </Surface.CompilerTest.DebugAnnotations.render> -->
<!-- <Surface.CompilerTest.DebugAnnotations.render> test/support/debug_annotations.sface:3 () -->render<!-- </Surface.CompilerTest.DebugAnnotations.render> -->
<!-- <Surface.CompilerTest.DebugAnnotations.render> test/support/debug_annotations.sface:3 () -->render<!-- </Surface.CompilerTest.DebugAnnotations.render> -->
</div>
"""
end
Expand All @@ -934,7 +934,7 @@ defmodule Surface.CompilerTest do

assert html == """
<div>
<!-- <Surface.CompilerTest.DebugAnnotations.debug_annotations> test/support/debug_annotations.sface:1 -->render<!-- </Surface.CompilerTest.DebugAnnotations.debug_annotations> -->
<!-- <Surface.CompilerTest.DebugAnnotations.debug_annotations> test/support/debug_annotations.sface:1 () -->render<!-- </Surface.CompilerTest.DebugAnnotations.debug_annotations> -->
</div>
"""
end
Expand Down
6 changes: 6 additions & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Borrowed solution from phoenix_live_view test_helper.exs
# https://github.com/phoenixframework/phoenix_live_view/blob/main/test/test_helper.exs#L4
Application.put_env(:phoenix_live_view, :debug_heex_annotations, true)
Code.require_file("test/support/debug_annotations.exs")
Application.put_env(:phoenix_live_view, :debug_heex_annotations, false)

ExUnit.start()
ExUnit.configure(exclude: [integration: true])

Expand Down
Loading