Raxol.Test.Visual.Assertions (Raxol v0.2.0)

View Source

Provides custom assertions for visual testing of Raxol components.

This module includes assertions for:

  • Component rendering verification
  • Layout validation
  • Style checking
  • Visual regression testing
  • Terminal output comparison

Summary

Functions

Asserts that a component's borders and edges align properly.

Asserts that a component's rendered output matches the expected snapshot.

Asserts that a component renders with the expected content.

Asserts that a component renders correctly at different terminal sizes.

Asserts that a component's style matches the expected theme.

Asserts that a component renders consistently across different themes.

Functions

assert_aligned(component, edges)

Asserts that a component's borders and edges align properly.

Example

assert_aligned component, :all
assert_aligned component, [:top, :left]

assert_matches_snapshot(component, name, context \\ %{})

Asserts that a component's rendered output matches the expected snapshot.

Example

assert_matches_snapshot(component, "button_primary")

assert_renders_with(component, expected)

Asserts that a component renders with the expected content.

Example

assert_renders_with component, "Expected Content"

assert_responsive(component, sizes)

Asserts that a component renders correctly at different terminal sizes.

Example

assert_responsive component, [
  {80, 24},
  {40, 12},
  {20, 6}
]

assert_styled_with(component, style)

Asserts that a component's style matches the expected theme.

Example

assert_styled_with component, %{color: :blue, bold: true}

assert_theme_consistent(component, themes)

Asserts that a component renders consistently across different themes.

Example

assert_theme_consistent component, %{
  light: light_theme,
  dark: dark_theme
}