Vnu.Assertions (Vnu v1.2.0)

View Source

ExUnit assertions for checking the validity of HTML, CSS, and SVG documents.

Summary

Functions

Asserts that the given CSS document is valid.

Asserts that the given HTML document is valid.

Asserts that the given SVG document is valid.

Functions

assert_valid_css(css, opts \\ [])

Asserts that the given CSS document is valid.

See assert_valid_html/2 for the list of options and other details.

assert_valid_html(html, opts \\ [])

Asserts that the given HTML document is valid.

Options

  • :server_url - The URL of the Checker server. Defaults to http://localhost:8888.
  • :fail_on_warnings - Messages of type :info and subtype :warning will be treated as if they were validation errors. Their presence will mean the document is invalid. Defaults to false.
  • :filter - A module implementing the Vnu.MessageFilter behavior that will be used to exclude messages matching the filter from the result. Defaults to nil (no excluded messages).
  • :http_client - A module implementing the Vnu.HTTPClient behaviour that will be used to make the HTTP request to the server. Defaults to Vnu.HTTPClient.Hackney.
  • :message_print_limit - The maximum number of validation messages that will me printed in the error when the assertion fails. Can be an integer or :infinity. Defaults to :infinity.

assert_valid_svg(svg, opts \\ [])

Asserts that the given SVG document is valid.

See assert_valid_html/2 for the list of options and other details.