Skip to content

module

testing

Helpers for testing apps built with weft-ui (used by the examples).

Functions

accessibility_issues

pub fn accessibility_issues(app: &App) -> Vec<String>

Accessibility issues on the current page (empty = clean).

advance

pub fn advance(seconds: f64)

Move the clock templates' timers run on by seconds, running the timers and animation frames that come due meanwhile.

assert_accessible

pub fn assert_accessible(app: &App)

Panic with the tree dump if the page has accessibility issues.

assert_styled

pub fn assert_styled(app: &App, theme: &Theme)

Panic if any class on the page produces no CSS.

has

pub fn has(app: &App, role: Role, name: &str) -> bool

Whether a node with role and name exists.

mount

pub fn mount(root: Component, registry: Registry) -> App

Mount root with registry into an in-memory host. Templates' requests go through weft_data's loader (install a fake with weft_data::source::set_loader), and their timers wait on the virtual clock until advance moves it.

path_of

pub fn path_of(app: &App, role: Role, name: &str) -> Vec<usize>

Path of the node with role and name (panics with the tree if absent).

unstyled_classes

pub fn unstyled_classes(app: &App, theme: &Theme) -> Vec<String>

Class names on the page that the Tailwind engine can't style.

window_event

pub fn window_event(event: &Event)

Send a window event (Event::new("resize")) to templates' @resize: handler declarations, as the browser would.