oxedyne/fe2o3/fe2o3_steel/tests/console_fix_diff.rs
1.3 KiB, 18 runs
created by r939070283:78556, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | //! The Fix panel shows a copy-edit as the words it changed, inline, in the post's own font: one word |
| 2 | //! diff over the whole text, so a paragraph the model merged or dropped cannot pair the rest wrongly |
| 3 | //! (15 Nov 2026, twice). |
| 4 | |
| 5 | use oxedyne_fe2o3_steel::srv::console::{ |
| 6 | SiteAdmin, |
| 7 | Theme, |
| 8 | page, |
| 9 | publish::FIX_SCRIPT, |
| 10 | }; |
| 11 | |
| 12 | #[test] |
| 13 | fn test_a_fix_is_one_word_diff_in_the_posts_font_00() { |
| 14 | // One diff over the whole text, never paragraphs paired by position, a markdown link one word. |
| 15 | assert!(!FIX_SCRIPT.contains("ps[++i]"), "paragraphs are paired by position"); |
| 16 | assert!(FIX_SCRIPT.contains(r"(?:\[[^\]]*\]\([^)]*\)|\S+)"), "a markdown link is not one word"); |
| 17 | assert!(FIX_SCRIPT.contains("' changes'"), "no count of changes"); |
| 18 | let theme = Theme { site_name: "S".to_string(), css: Vec::new(), home: "/".to_string() }; |
| 19 | let admin = SiteAdmin { username: "0".repeat(64) }; |
| 20 | let html = page(&theme, &admin, "T", "").body_as_string().to_string(); |
| 21 | let rule = |sel: &str| -> String { |
| 22 | let at = html.find(&format!("{}{{", sel)).unwrap_or(0); |
| 23 | html[at..].split('}').next().unwrap_or("").to_string() |
| 24 | }; |
| 25 | assert!(!rule(".mc-fix-diff").contains("monospace")); |
| 26 | assert!(!rule(".mc-fix-diff ins").contains("display:block")); |
| 27 | assert!(!rule(".mc-fix-diff del").contains("display:block")); |
| 28 | } |