Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: configure runtime attributes function (#202)
- Loading branch information
Showing
7 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
defmodule Temple.Support.Helpers do | ||
import ExUnit.Assertions | ||
|
||
defmacro assert_html(expected, actual) do | ||
quote do | ||
assert unquote(expected) == Phoenix.HTML.safe_to_string(unquote(actual)), """ | ||
--- Expected --- | ||
#{unquote(expected)}---------------- | ||
--- Actual --- | ||
#{Phoenix.HTML.safe_to_string(unquote(actual))}-------------- | ||
""" | ||
quote location: :keep do | ||
unquote(__MODULE__).__assert_html__(unquote_splicing([expected, actual])) | ||
end | ||
end | ||
|
||
def __assert_html__(expected, actual) do | ||
actual = actual |> Phoenix.HTML.Engine.encode_to_iodata!() |> IO.iodata_to_binary() | ||
|
||
assert expected == actual, | ||
""" | ||
--- Expected --- | ||
#{expected}---------------- | ||
--- Actual --- | ||
#{actual}-------------- | ||
""" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters