fix tests

This commit is contained in:
FloatingGhost 2023-08-06 18:12:51 +01:00
parent 066a699ade
commit 1b1585657f
5 changed files with 28 additions and 149 deletions

View file

@ -1,2 +1,2 @@
elixir ref:v1.13.4
erlang 25.0-rc2
elixir 1.15.4-otp-26
erlang 26.0.2

View file

@ -40,7 +40,7 @@ defmodule Temple.Parser do
"""
@callback run(ast :: Macro.t()) :: ast()
@aliases Application.get_env(:temple, :aliases, [])
@aliases Application.compile_env(:temple, :aliases, [])
@nonvoid_elements ~w[
head title style script

View file

@ -35,7 +35,7 @@ defmodule Temple.Parser.NonvoidElementsAliases do
)
end
defp whitespace(meta) do
defp whitespace(_meta) do
:tight
end
end

View file

@ -52,7 +52,7 @@ defmodule Temple.Parser.TempleNamespaceNonvoidTest do
attrs: [class: "foo", id: {:var, [], _}],
children: %Temple.Parser.ElementList{
children: [%Temple.Parser.Text{text: "foo"}],
whitespace: :loose
whitespace: :tight
}
} = ast
end

View file

@ -13,7 +13,7 @@ defmodule Temple.RendererTest do
"hello world"
end
assert "hello world\n" == result
assert "hello world" == result
end
test "produces renders a div" do
@ -27,14 +27,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div class="hello world">
hello world
<span id="name">bob</span>
</div>
"""
expected = ~S|<div class="hello world">hello world<span id="name">bob</span></div>|
assert expected == result
end
@ -51,15 +44,8 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div class="hello world">
hello world
<input type="button" value="Submit">
<input type="button" value="Submit">
</div>
"""
expected =
~S|<div class="hello world">hello world<input type="button" value="Submit"><input type="button" value="Submit"></div>|
assert expected == result
end
@ -75,13 +61,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div class="hello world">
<span id="name">bob</span>
</div>
"""
expected = ~S|<div class="hello world"><span id="name">bob</span></div>|
assert expected == result
end
@ -97,12 +77,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div class="green">
hello world
</div>
"""
expected = ~S|<div class="green">hello world</div>|
assert expected == result
end
@ -139,12 +114,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
hello world
</div>
"""
expected = ~S|<div>hello world</div>|
assert expected == result
end
@ -162,15 +132,8 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<span class="name">alice</span>
<span class="name">bob</span>
<span class="name">carol</span>
</div>
"""
expected =
~S|<div><span class="name">alice</span><span class="name">bob</span><span class="name">carol</span></div>|
assert expected == result
end
@ -191,13 +154,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<span>#{val}</span>
</div>
"""
expected = ~s|<div><span>#{val}</span></div>|
assert expected == result
end
@ -224,13 +181,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<span>#{val}</span>
</div>
"""
expected = ~s|<div><span>#{val}</span></div>|
assert expected == result
end
@ -240,13 +191,7 @@ defmodule Temple.RendererTest do
assigns = %{name: "alice"}
# html
expected = """
<div>
<span id="correct answer">alice is the best</span>
</div>
"""
expected = ~S|<div><span id="correct answer">alice is the best</span></div>|
result =
Renderer.compile do
@ -280,18 +225,8 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<span class="name">alice</span>
<span class="name">bob</span>
<span class="name">carol</span>
</div>
"""
expected =
~S|<div><span class="name">alice</span><span class="name">bob</span><span class="name">carol</span></div>|
assert expected == result
end
@ -317,18 +252,8 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<span class="name">alice</span>
<span class="name">bob</span>
<span class="name">carol</span>
</div>
"""
expected =
~S|<div><span class="name">alice</span><span class="name">bob</span><span class="name">carol</span></div>|
assert expected == result
end
@ -350,16 +275,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<div>
I am a basic component
</div>
</div>
"""
expected = ~S|<div><div>I am a basic component</div></div>|
assert expected == result
end
@ -384,18 +300,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div>
<div>
I am above the slot
<span>i'm a slot</span>
</div>
</div>
"""
expected = ~S|<div><div>I am above the slot<span>i'm a slot</span></div></div>|
assert expected == result
end
@ -430,25 +335,8 @@ defmodule Temple.RendererTest do
end
# heex
expected = """
<div>
<div>
motchy boi is above the slot
<span>i'm a slot</span>
</div>
<footer>
<p>
motchy boi's in the footer!
</p>
</footer>
</div>
"""
expected =
~S|<div><div>motchy boi is above the slot<span>i'm a slot</span></div><footer><p>motchy boi's in the footer!</p></footer></div>|
assert expected == result
end
@ -464,12 +352,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<div class="text-red">
hello world
</div>
"""
expected = ~S|<div class="text-red">hello world</div>|
assert expected == result
end
@ -481,9 +364,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<input type="text" disabled placeholder="Enter some text...">
"""
expected = ~S|<input type="text" disabled placeholder="Enter some text...">|
assert expected == result
end
@ -495,9 +376,7 @@ defmodule Temple.RendererTest do
end
# html
expected = """
<input type="text" placeholder="Enter some text...">
"""
expected = ~S|<input type="text" placeholder="Enter some text...">|
assert expected == result
end