seen
\ "; let text = text_of(html); assert!(text.contains("seen")); assert!(text.contains("pid"), "element ids are addressable surface"); assert!( !text.contains("STYLETOKEN"), "style contents leaked into the text" ); assert!( !text.contains("SCRIPTTOKEN"), "script contents leaked into the text" ); } /// Control 5, asserted at the document level: the emitted JavaScript /// must contain no game vocabulary. If a rule ever needs to live in /// the page, ADR-0007 says revisit the decision, not widen this. #[test] fn the_emitted_javascript_contains_no_game_vocabulary() { let doc = document(&fixture(), &[], "/command?t=x", Some(PlayerId(0)), false); let script = doc .split_once("")) .map(|(s, _)| s.to_string()) .expect("the document carries a script"); for word in [ "Investigate", "Solve", "Support", "Attack", "Ground", "darvo", "DARVO", "stress", "freedom", "problem", "coalition", "reveal", "resolve", ] { assert!( !script.contains(word), "the emitted JavaScript mentions {word:?} — control 5 is breached" ); } // And it must still be doing its one job. assert!(script.contains("pointerdown") && script.contains("pointerup")); } /// The renderer must not invent a hand it was never given. /// /// Scoped deliberately: the *projection's* hiding rules are asserted /// where they live, and re-asserting them here would be a duplicated /// fact that drifts. What this checks is the renderer's own failure /// mode — that `hand: None` renders as an absence, for every seat, and /// that a spectator's document contains no open hand at all. #[test] fn the_renderer_never_invents_a_hand_it_was_not_given() { for seat in [0u8, 1, 2] { let view = crate::testfix::view(Some(PlayerId(seat))); let text = rendered_document(&view); let shown = text.matches("cards)").count(); assert_eq!( shown, 1, "P{} sees {shown} open hands in the document; it was given exactly one", seat + 1 ); assert_eq!( text.matches("card(s), hidden").count(), 2, "the other two seats' hands must render as an absence with a count" ); } let text = rendered_document(&crate::testfix::view(None)); assert_eq!( text.matches("cards)").count(), 0, "a spectator document shows an open hand" ); assert!(text.contains("a spectator (no hands)")); } } /// CB-WP-0016 T03: every affordance the page offers must name an element /// the page actually contains. /// /// **This is the check that closes the class the human check found.** On /// 2026-08-02 the maintainer ran `cb-play --serve 0` and could not drag an /// action onto a seat. Every test in the repo was green. The cause: the /// visible seat cards carried no `id`, so `seat-{n}` existed only on the /// 26 px circles inside the relationship graph, while every action card /// read *"drag Attack onto a seat…"*. /// /// Nothing could catch it. `jsrun::gesture` feeds element ids straight /// into a synthetic `{target:{id}}` and never hit-tests, so it establishes /// *"the script posts the ids it was given"* — never *"there is an element /// there to give."* The 42-path coverage gate asserts each view field is /// present in the parsed document, which a `