diff --git a/.doctor.exs b/.doctor.exs new file mode 100644 index 0000000..55e2cc9 --- /dev/null +++ b/.doctor.exs @@ -0,0 +1,15 @@ +%Doctor.Config{ + exception_moduledoc_required: true, + failed: false, + ignore_modules: [MjmlEEx], + ignore_paths: [], + min_module_doc_coverage: 40, + min_module_spec_coverage: 0, + min_overall_doc_coverage: 50, + min_overall_spec_coverage: 0, + moduledoc_required: true, + raise: false, + reporter: Doctor.Reporters.Full, + struct_type_spec_required: true, + umbrella: false +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..2f8876b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [akoutmos] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..37a3c30 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,79 @@ +name: MJML EEx CI + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SHELL: sh + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + static_analysis: + name: Static Analysis + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Elixir + uses: erlef/setup-elixir@v1 + with: + elixir-version: '1.13.3' + otp-version: '24.2' + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: deps + key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-v2- + - name: Install dependencies + run: mix deps.get + - name: Restore PLT cache + uses: actions/cache@v2 + with: + path: priv/plts + key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-v2- + - name: Mix Formatter + run: mix format --check-formatted + - name: Check for compiler warnings + run: mix compile --warnings-as-errors + - name: Credo strict checks + run: mix credo --strict + - name: Doctor documentation checks + run: mix doctor + + unit_test: + name: Run ExUnit tests + runs-on: ubuntu-latest + + strategy: + matrix: + elixir: + - '1.13.3' + otp: + - '24.2' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Elixir + uses: erlef/setup-elixir@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: deps + key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-v2- + - name: Install dependencies + run: mix deps.get + - name: ExUnit tests + env: + MIX_ENV: test + run: mix coveralls.github diff --git a/README.md b/README.md index 1130da7..f02d8dc 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,43 @@ -# MjmlEEx +

+ MJML EEx Logo +

-**TODO: Add description** +

+ Easily create beautiful email using MJML right from Elixir! +

+ +

+ + Hex.pm + + + + GitHub Workflow Status (master) + + + + Coveralls master branch + + + + Support the project + +

+ +
+ +# Contents + +- [Installation](#installation) +- [Supporting MJML EEx](#supporting-mjml_eex) +- [Setting Up MJML EEx](#setting-up-mjml_eex) +- [Attribution](#attribution) ## Installation -If [available in Hex](https://hex.pm/docs/publish), the package can be installed -by adding `mjml_eex` to your list of dependencies in `mix.exs`: +[Available in Hex](https://hex.pm/packages/mjml_eex), the package can be installed by adding `mjml_eex` to your list of +dependencies in `mix.exs`: ```elixir def deps do @@ -15,6 +47,41 @@ def deps do end ``` -Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) -and published on [HexDocs](https://hexdocs.pm). Once published, the docs can -be found at [https://hexdocs.pm/mjml_eex](https://hexdocs.pm/mjml_eex). +Documentation can be found at [https://hexdocs.pm/mjml_eex](https://hexdocs.pm/mjml_eex). + +## Supporting MJML EEx + +If you rely on this library to generate awesome looking emails for your application, it would much appreciated +if you can give back to the project in order to help ensure its continued development. + +Checkout my [GitHub Sponsorship page](https://github.com/sponsors/akoutmos) if you want to help out! + +### Gold Sponsors + + + Support the project + + +### Silver Sponsors + + + Support the project + + +### Bronze Sponsors + + + Support the project + + +## Setting Up MJML EEx + +After adding `{:mjml_eex, "~> 0.1.0"}` in your `mix.exs` file and running `mix deps.get` + +With those in place, you should be all set to go! + +## Attribution + +- The logo for the project is an edited version of an SVG image from the [unDraw project](https://undraw.co/) +- The Elixir MJML library that this library builds on top of [MJML](https://github.com/adoptoposs/mjml_nif) +- The Rust MRML library that provides the MJML compilation functionality [MRML](https://github.com/jdrouet/mrml) diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..7aec11f --- /dev/null +++ b/config/config.exs @@ -0,0 +1,18 @@ +import Config + +if Mix.env() != :prod do + config :git_hooks, + auto_install: true, + verbose: true, + hooks: [ + pre_commit: [ + tasks: [ + {:cmd, "mix format --check-formatted"}, + {:cmd, "mix compile --warnings-as-errors"}, + {:cmd, "mix credo --strict"}, + {:cmd, "mix doctor"}, + {:cmd, "mix test"} + ] + ] + ] +end diff --git a/guides/images/logo.svg b/guides/images/logo.svg new file mode 100644 index 0000000..f1d8bc6 --- /dev/null +++ b/guides/images/logo.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + MJML + diff --git a/lib/engines/mjml.ex b/lib/engines/mjml.ex index ed17da4..3f551e8 100644 --- a/lib/engines/mjml.ex +++ b/lib/engines/mjml.ex @@ -36,8 +36,7 @@ defmodule MjmlEEx.Engines.Mjml do end def handle_expr(state, marker, expr) do - encoded_code = Utils.encode_expression(marker, expr) - encoded_expression = "__MJML_EEX_START__:#{encoded_code}:__MJML_EEX_END__" + encoded_expression = Utils.encode_expression(marker, expr) %{binary: binary} = state %{state | binary: [encoded_expression | binary]} diff --git a/lib/utils.ex b/lib/utils.ex index 2a073c1..4d24902 100644 --- a/lib/utils.ex +++ b/lib/utils.ex @@ -3,18 +3,31 @@ defmodule MjmlEEx.Utils do General MJML EEx utils reside here for encoding and decoding Elixir expressions in MJML EEx templates. """ + + @doc """ + This function encodes the internals of an MJML EEx document + so that when it is compiled, the EEx expressions don't break + the MJML compiler. + """ def encode_expression(marker, expression) do - Base.encode16("<%#{marker} #{Macro.to_string(expression)} %>") - end + encoded_code = Base.encode16("<%#{marker} #{Macro.to_string(expression)} %>") - def decode_expression(encoded_string) do - Base.decode16!(encoded_string) + "__MJML_EEX_START__:#{encoded_code}:__MJML_EEX_END__" end + @doc """ + This function finds all of the instances of of encoded EEx expressions + and decodes them so that when the EEx HTML template is finally + rendered, the expressions are executed as expected. + """ def decode_eex_expressions(email_document) do ~r/__MJML_EEX_START__:([^:]+):__MJML_EEX_END__/ |> Regex.replace(email_document, fn _, base16_code -> "#{decode_expression(base16_code)}" end) end + + defp decode_expression(encoded_string) do + Base.decode16!(encoded_string) + end end diff --git a/mix.exs b/mix.exs index 9e626a9..dcc6d1c 100644 --- a/mix.exs +++ b/mix.exs @@ -13,7 +13,9 @@ defmodule MjmlEEx.MixProject do description: "A wrapper around https://hex.pm/packages/mjml to easily use MJML with EEx", start_permanent: Mix.env() == :prod, package: package(), - deps: deps() + deps: deps(), + docs: docs(), + aliases: aliases() ] end @@ -41,12 +43,46 @@ defmodule MjmlEEx.MixProject do ] end + defp docs do + [ + main: "readme", + source_ref: "master", + logo: "guides/images/logo.svg", + extras: ["README.md"] + ] + end + # Run "mix help deps" to learn about dependencies. defp deps do [ + # Production deps {:mjml, "~> 1.3.2"}, {:phoenix_html, "~> 3.2.0"}, - {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} + + # Development deps + {:ex_doc, "~> 0.28.2", only: :dev}, + {:excoveralls, "~> 0.14.4", only: [:test, :dev], runtime: false}, + {:doctor, "~> 0.18.0", only: :dev}, + {:credo, "~> 1.6.1", only: :dev}, + {:git_hooks, "~> 0.7.3", only: [:test, :dev], runtime: false} + ] + end + + defp aliases do + [ + docs: ["docs", ©_files/1] ] end + + defp copy_files(_) do + # Set up directory structure + File.mkdir_p!("./doc/guides/images") + + # Copy over image files + "./guides/images/" + |> File.ls!() + |> Enum.each(fn image_file -> + File.cp!("./guides/images/#{image_file}", "./doc/guides/images/#{image_file}") + end) + end end diff --git a/mix.lock b/mix.lock index 8cadb06..82526c5 100644 --- a/mix.lock +++ b/mix.lock @@ -1,15 +1,32 @@ %{ + "blankable": {:hex, :blankable, "1.0.0", "89ab564a63c55af117e115144e3b3b57eb53ad43ba0f15553357eb283e0ed425", [:mix], [], "hexpm", "7cf11aac0e44f4eedbee0c15c1d37d94c090cb72a8d9fddf9f7aec30f9278899"}, + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "castore": {:hex, :castore, "0.1.16", "2675f717adc700475345c5512c381ef9273eb5df26bdd3f8c13e2636cf4cc175", [:mix], [], "hexpm", "28ed2c43d83b5c25d35c51bc0abf229ac51359c170cba76171a462ced2e4b651"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"}, - "ex_doc": {:hex, :ex_doc, "0.26.0", "1922164bac0b18b02f84d6f69cab1b93bc3e870e2ad18d5dacb50a9e06b542a3", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2775d66e494a9a48355db7867478ffd997864c61c65a47d31c4949459281c78d"}, + "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, + "credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"}, + "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, + "doctor": {:hex, :doctor, "0.18.0", "114934c1740239953208a39db617699b7e2660770e81129d7f95cdf7837ab766", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "829c88c365f72c0666e443ea670ffb6f180de7b90c23d536edabdd8c722b88f4"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.25", "2024618731c55ebfcc5439d756852ec4e85978a39d0d58593763924d9a15916f", [:mix], [], "hexpm", "56749c5e1c59447f7b7a23ddb235e4b3defe276afc220a6227237f3efe83f51e"}, + "ex_doc": {:hex, :ex_doc, "0.28.3", "6eea2f69995f5fba94cd6dd398df369fe4e777a47cd887714a0976930615c9e6", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "05387a6a2655b5f9820f3f627450ed20b4325c25977b2ee69bed90af6688e718"}, + "excoveralls": {:hex, :excoveralls, "0.14.4", "295498f1ae47bdc6dce59af9a585c381e1aefc63298d48172efaaa90c3d251db", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e3ab02f2df4c1c7a519728a6f0a747e71d7d6e846020aae338173619217931c1"}, + "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "git_hooks": {:hex, :git_hooks, "0.7.3", "09489e94d88dfc767662e22aff2b6208bd7cf555a19dd0e1477cca4683ce0701", [:mix], [{:blankable, "~> 1.0.0", [hex: :blankable, repo: "hexpm", optional: false]}, {:recase, "~> 0.7.0", [hex: :recase, repo: "hexpm", optional: false]}], "hexpm", "d6ddedeb4d3a8602bc3f84e087a38f6150a86d9e790628ed8bc70e6d90681659"}, + "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, - "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"}, + "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "mjml": {:hex, :mjml, "1.3.2", "4889ca9341c288ef46d94dd338ae91b5ea338539b4b548c6a5d6b36dc099c5fa", [:mix], [{:rustler_precompiled, "~> 0.2.0", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "78efd5985462f5eb759917f6b843acace5b07fde2bb1b8ddcb0176ee2f5d6dff"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"}, + "recase": {:hex, :recase, "0.7.0", "3f2f719f0886c7a3b7fe469058ec539cb7bbe0023604ae3bce920e186305e5ae", [:mix], [], "hexpm", "36f5756a9f552f4a94b54a695870e32f4e72d5fad9c25e61bc4a3151c08a4e0c"}, "rustler": {:hex, :rustler, "0.25.0", "32526b51af7e58a740f61941bf923486ce6415a91c3934cc16c281aa201a2240", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "6b43a11a37fe79c6234d88c4102ab5dfede7a6a764dc5c7b539956cfa02f3cf4"}, "rustler_precompiled": {:hex, :rustler_precompiled, "0.2.0", "8cb0fb2527d51de624e91b45e0a2b12c92e1cb614f8616f8dfc07c3d1180f48a", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: false]}], "hexpm", "583be3d480fa292770d45d4e20418ad81b6d9acd2bc42d8776e79f4a283cbae4"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/test/mjml_eex_test.exs b/test/mjml_eex_test.exs index 5e7a6b2..4868559 100644 --- a/test/mjml_eex_test.exs +++ b/test/mjml_eex_test.exs @@ -63,9 +63,7 @@ defmodule MjmlEExTest do describe "ComponentTemplate.render/1" do test "should render the document with the head and attribute block" do assert ComponentTemplate.render(all_caps: true) =~ "SIGN UP TODAY!!" - assert ComponentTemplate.render(all_caps: true) =~ "mj-head" - assert ComponentTemplate.render(all_caps: true) =~ "mj-font name=\"Roboto\"" - assert ComponentTemplate.render(all_caps: true) =~ "mj-attributes" + assert ComponentTemplate.render(all_caps: true) =~ "Montserrat, Helvetica, Arial, sans-serif" end end diff --git a/test/test_templates/component_template.mjml.eex b/test/test_templates/component_template.mjml.eex index 259d29f..2b7c200 100644 --- a/test/test_templates/component_template.mjml.eex +++ b/test/test_templates/component_template.mjml.eex @@ -34,7 +34,7 @@ Marketers/advertisers usually focus their efforts on the people responsible for making the purchase. In many cases, this is an effective approach but in other cases it can make for a totally useless marketing campaign. - <%= @call_to_action_text %> + SIGN UP TODAY!!