iced-cube 0.0.21

Themeable application components for the iced GUI library, with Lucide icons
Documentation
#![cfg(feature = "alert")]

use iced::Element;
use iced_cube::alert;
use iced_cube::feedback::alert::Variant;
use iced_test::simulator;

#[test]
fn every_variant_renders_title_and_description() {
    for variant in Variant::ALL {
        let element: Element<'_, ()> = alert("Heads up")
            .description("Your trial ends in three days.")
            .variant(variant)
            .into();
        let mut ui = simulator(element);
        assert!(ui.find("Heads up").is_ok(), "{variant:?}");
        assert!(
            ui.find("Your trial ends in three days.").is_ok(),
            "{variant:?}"
        );
    }
}

#[test]
fn title_only_alert_renders() {
    let element: Element<'_, ()> = alert("Saved").variant(Variant::Success).into();
    let mut ui = simulator(element);
    assert!(ui.find("Saved").is_ok());
}

#[cfg(feature = "icedwright")]
#[path = "support/semantic.rs"]
mod semantic;

#[cfg(feature = "icedwright")]
#[test]
fn an_alert_reports_its_title_and_description() {
    let element: Element<'_, ()> = alert("Saved").description("All changes are kept.").into();
    assert_eq!(
        semantic::yaml(element),
        "- alert \"Saved\" [description=\"All changes are kept.\"]:\n  \
         - text: Saved\n  - text: All changes are kept.\n"
    );
}