Raxol.Test.Visual.Matchers (Raxol v0.4.0)

View Source

Provides pattern matching helpers for visual testing of Raxol components.

This module includes matchers for:

  • ANSI color and style patterns
  • Terminal layout patterns
  • Border and edge patterns
  • Component structure patterns

Summary

Functions

Matches specific text alignment patterns in the output.

Matches box drawing characters in the output.

Matches ANSI color codes in the output.

Matches specific component patterns in the output.

Matches specific layout patterns in the output.

Matches ANSI style codes in the output.

Functions

matches_alignment(output, alignment, opts \\ [])

Matches specific text alignment patterns in the output.

Example

output
|> matches_alignment(:left)
|> matches_alignment(:right, width: 80)

matches_box_edges(output)

Matches box drawing characters in the output.

Example

output
|> matches_box_edges()
|> matches_box_corners()

matches_color(output, color, content)

Matches ANSI color codes in the output.

Example

output
|> matches_color(:red, "Error message")
|> matches_color(:green, "Success")

matches_component(output, type, opts \\ [])

Matches specific component patterns in the output.

Example

output
|> matches_component(:button, "Click me")
|> matches_component(:input, placeholder: "Enter text")

matches_layout(output, layout, opts \\ [])

Matches specific layout patterns in the output.

Example

output
|> matches_layout(:centered)
|> matches_layout(:padded, padding: 2)

matches_style(output, style, content)

Matches ANSI style codes in the output.

Example

output
|> matches_style(:bold, "Important")
|> matches_style(:underline, "Link")