View Source DomHelpers.Assertions (dom_helpers v0.3.1)

This module contains some extra helpers specially for assertions, though is preferred to use direct comparisons with the different selectors and accessors.

Summary

Functions

Checks if the given selector is found at least once in the given document. Works like has_element?/2 but with the parameters reversed so you can pipe when building the selector.

Functions

Link to this function

is_in?(selector, htmlable)

View Source

Checks if the given selector is found at least once in the given document. Works like has_element?/2 but with the parameters reversed so you can pipe when building the selector.

Example

iex> "li" |> is_in?("<ul><li>First</li><li>Second</li></ul>")
true

iex> "li" |> is_in?("<ul><li>First</li></ul>")
true

iex> "span" |> is_in?("<ul><li>First</li></ul>")
false