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

Types

The assertions result

An assertion

A list of assertions

An HTML document as a string

Functions

Run the assertions against the given html string.

Link to this section Types

@type assert_result() :: [:ok | {:fail, String.t()}]

The assertions result

@type assertion() :: {atom(), String.t() | tuple()}

An assertion

@type assertions() :: [assertions()]

A list of assertions

@type html() :: String.t()

An HTML document as a string

Link to this section Functions

Link to this function

dom_assert(html, assertions)

View Source
@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."}]