View Source Adh (ADH - Assert DOM Helpers v0.1.0)
Adh is a tiny library of helpers to make assertions on DOM.
Powered by Floki.
Link to this section Summary
Functions
Run the assertions against the given html string.
Link to this section Types
@type assert_result() :: [:ok | {:fail, String.t()}]
The assertions result
An assertion
@type assertions() :: [assertions()]
A list of assertions
@type html() :: String.t()
An HTML document as a string
Link to this section Functions
@spec dom_assert(html(), assertions()) :: assert_result() | no_return()
Run the assertions against the given html string.
examples
Examples
iex> Adh.dom_assert("<p class='red'>Red Text</p>", [{:dom_present, ".red"}])
[:ok]
iex> Adh.dom_assert("<p class='red'>Red Text</p>", [{:dom_present, ".yellow"}])
[{:fail, "dom present: `.yellow` is not present."}]