test(markdown): verify aspect-ratio uses slash separator with real dimensions

This commit is contained in:
xfy 2026-06-22 18:24:29 +08:00
parent 6e98c2abfa
commit d194f17013

View File

@ -364,6 +364,17 @@ mod tests {
assert!(!result.contains("blur-img"), "external image should not be wrapped"); assert!(!result.contains("blur-img"), "external image should not be wrapped");
} }
#[test]
fn wrap_images_with_blur_uses_slash_in_aspect_ratio() {
// 用真实存在的 uploads 文件,让 dimensions 成功返回,验证 --ar 格式
let html = r#"<img src="/uploads/2026/06/18/090402.21c4f0b6-6d5a-49ee-bc79-99cb557ff385.webp" alt="t">"#;
let result = wrap_images_with_blur(html);
println!("ACTUAL OUTPUT: {}", result);
// aspect-ratio 必须用斜杠分隔,如 "--ar:800 / 600;"
assert!(result.contains("--ar:"), "should have --ar");
assert!(result.contains(" / "), "aspect-ratio must use slash separator, got: {}", result);
}
#[test] #[test]
fn slugify_heading_simple() { fn slugify_heading_simple() {
assert_eq!(slugify_heading("Hello World"), "hello-world"); assert_eq!(slugify_heading("Hello World"), "hello-world");