From 48c5eacf253117d1b5231107dea1bd91ca04c561 Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Sat, 27 Apr 2019 11:44:08 -0400 Subject: [PATCH] Rename component to defcomponent --- lib/dsl/html.ex | 2 +- test/dsl/html_test.exs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/dsl/html.ex b/lib/dsl/html.ex index e81bdb3..31565c5 100644 --- a/lib/dsl/html.ex +++ b/lib/dsl/html.ex @@ -86,7 +86,7 @@ defmodule Dsl.Html do defmacro partial(text), do: quote(do: text(unquote(text))) - defmacro component(name, do: block) do + defmacro defcomponent(name, do: block) do quote do defmacro unquote(name)(props \\ []) diff --git a/test/dsl/html_test.exs b/test/dsl/html_test.exs index 422a592..58b9063 100644 --- a/test/dsl/html_test.exs +++ b/test/dsl/html_test.exs @@ -3,11 +3,11 @@ defmodule Dsl.HtmlTest do use Dsl defmodule Component do - component :flex do + defcomponent :flex do div(class: "flex") end - component :takes_children do + defcomponent :takes_children do div do div(id: "static-child-1") @children @@ -15,7 +15,7 @@ defmodule Dsl.HtmlTest do end end - component :arbitrary_code do + defcomponent :arbitrary_code do num = 1..10 |> Enum.reduce(0, fn x, sum -> x + sum end) div do @@ -23,7 +23,7 @@ defmodule Dsl.HtmlTest do end end - component :uses_conditionals do + defcomponent :uses_conditionals do if @condition do div() else @@ -31,7 +31,7 @@ defmodule Dsl.HtmlTest do end end - component :arbitrary_data do + defcomponent :arbitrary_data do for item <- @lists do div do text(inspect(item)) @@ -39,11 +39,11 @@ defmodule Dsl.HtmlTest do end end - component :safe do + defcomponent :safe do div() end - component :safe_with_prop do + defcomponent :safe_with_prop do div id: "safe-with-prop" do text(@prop)