nexus-stratum-test 0.1.0

Test utilities for NexusStratum
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented0 out of 7 items with examples
  • Size
  • Source code size: 9.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.46 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 48s Average build duration of successful builds.
  • all releases: 48s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • AutomataNexus/NexusStratum
    3 3 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AutomataControls

stratum-test

Purpose

Test utilities for verifying component rendering, ARIA compliance, keyboard interaction, and end-to-end behavior.

Position in Pipeline

   stratum-leptos   stratum-dioxus
        |                |
        +-------+--------+
                |
          stratum-test
                |
          (test suites)

Depends on: stratum-leptos, stratum-dioxus Used by: Test suites across the workspace

Key Public API

Item Description
Render tests Mount components in a virtual DOM and assert on output
ARIA tests Assert correct ARIA roles, attributes, and live region announcements
Keyboard tests Simulate keyboard events and verify focus management
E2E tests Browser-based end-to-end test harness

Usage Example

use stratum_test::{render, screen, keyboard, aria};
use stratum_leptos::Button;

#[test]
fn button_has_correct_role() {
    render(|| view! { <Button>"Click"</Button> });

    let btn = screen::get_by_role("button");
    assert!(btn.is_some());
    aria::assert_role(&btn.unwrap(), "button");
}

#[test]
fn button_responds_to_enter_key() {
    let clicked = std::cell::Cell::new(false);
    render(|| view! { <Button on:click=|_| clicked.set(true)>"Go"</Button> });

    let btn = screen::get_by_role("button").unwrap();
    keyboard::press(&btn, Key::Enter);
    assert!(clicked.get());
}

How to Run Tests

cargo test -p stratum-test