cranpose 0.1.162

Cranpose runtime and UI facade
Documentation
use super::canvas_inline_styles;

fn properties(fill_viewport: bool) -> Vec<&'static str> {
    canvas_inline_styles(fill_viewport)
        .iter()
        .map(|(property, _)| *property)
        .collect()
}

#[test]
fn page_laid_out_canvases_keep_the_box_their_container_gives_them() {
    assert_eq!(properties(false), vec!["touch-action"]);
}

#[test]
fn viewport_filling_canvases_take_the_whole_viewport() {
    assert_eq!(
        canvas_inline_styles(true),
        [
            ("width", "100vw"),
            ("height", "100vh"),
            ("height", "100dvh"),
            ("touch-action", "none"),
        ]
    );
}

#[test]
fn viewport_filling_heights_end_on_the_dynamic_unit() {
    let heights: Vec<&str> = canvas_inline_styles(true)
        .iter()
        .filter(|(property, _)| *property == "height")
        .map(|(_, value)| *value)
        .collect();
    assert_eq!(heights, vec!["100vh", "100dvh"]);
}

#[test]
fn every_mode_takes_pointer_gestures_from_the_browser() {
    for fill_viewport in [false, true] {
        assert!(canvas_inline_styles(fill_viewport).contains(&("touch-action", "none")));
    }
}