diff --git a/lib/dom_helpers.ex b/lib/dom_helpers.ex index 2619329..c212fb3 100644 --- a/lib/dom_helpers.ex +++ b/lib/dom_helpers.ex @@ -10,6 +10,7 @@ defmodule DomHelpers do defmacro __using__(_opts) do quote do import DomHelpers.Accessors + import DomHelpers.Assertions import DomHelpers.Selectors end end diff --git a/lib/dom_helpers/assertions.ex b/lib/dom_helpers/assertions.ex new file mode 100644 index 0000000..09e0d72 --- /dev/null +++ b/lib/dom_helpers/assertions.ex @@ -0,0 +1,32 @@ +defmodule DomHelpers.Assertions do + @moduledoc """ + This module contains some extra helpers specially for assertions, + though is preferred to use direct comparisons with the different + [selectors](`DomHelpers.Selectors`) and [accessors](`DomHelpers.Accessors`). + """ + + import DomHelpers.Accessors + + @doc """ + Checks if the given selector is found at least once + in the given document. Works like [`has_element?/2`](`Phoenix.LiveViewTest.has_element?/2`) + but with the parameters reversed so you can pipe when + building the selector. + + ## Example + + ``` + iex> "li" |> is_in?("