//! What the renderer promises, asserted. //! //! Two kinds of test here, and the second is the interesting one. The first //! checks that a description comes out as the markup it should. The second //! checks the architectural claims the design rests on — that no `hx-target` //! is ever emitted, that htmx appears in exactly one function, that a //! description's text cannot become markup — because those are the properties //! that would decay silently, one convenient exception at a time. use makeover_layout as layout; use quasi_http::Serves; use quasi_router::screen::{ Act, Cell, Cells, Choice, Column, Field, Figure, Meter, Prose, Rest, Row, Tag, }; use quasi_router::{Action, Node, RegionKind, Screen, Slot}; use crate::{Emit, Shell, Webview}; /// A head with the screen's discovery tags removed. /// /// They are the one part of the head that comes off the `Screen` rather than /// off the `Shell`, so a comparison against the shell's own parts has to drop /// them or it is comparing two different questions. fn strip_discovery(head: &str) -> String { let mut out = String::with_capacity(head.len()); let mut rest = head; while let Some(start) = rest.find("').expect("a tag closes") + start + 1; rest = &rest[end..]; } out.push_str(rest); out } fn render(screen: &Screen) -> String { Webview::new().screen(screen) } fn fragment(node: &Node) -> String { Webview::new().fragment(node) } #[test] fn a_screen_is_a_whole_document() { let html = render(&Screen::list_detail("Tasks", false)); assert!(html.starts_with("")); assert!(html.contains("