| index 73436d5..637f408 100644 |
| --- a/core/tests/images.rs |
| +++ b/core/tests/images.rs |
| @@ -38,7 +38,12 @@ fn own_src() -> String { |
| #[test] |
| fn own_image_draws_under_the_signed_in_base() { |
| let src = own_src(); |
| - let doc = with_image(&[("src", &src), ("alt", "A cat"), ("width", "640"), ("height", "480")]); |
| + let doc = with_image(&[ |
| + ("src", &src), |
| + ("alt", "A cat"), |
| + ("width", "640"), |
| + ("height", "480"), |
| + ]); |
| assert_eq!( |
| fragment_html_in(&doc, &signed_in()), |
| format!( |
| @@ -54,10 +59,15 @@ fn own_image_draws_under_a_public_base_without_the_sqid() { |
| let view = View::parse(&format!("{OWN}\n/p/AbC-_9xyzAbC-_9xyzAb")).expect("view"); |
| let html = fragment_html_in(&doc, &view); |
| assert!( |
| - html.contains(&format!("<img src=\"/p/AbC-_9xyzAbC-_9xyzAb/images/{ID}\" alt=\"\"")), |
| + html.contains(&format!( |
| + "<img src=\"/p/AbC-_9xyzAbC-_9xyzAb/images/{ID}\" alt=\"\"" |
| + )), |
| "got {html}" |
| ); |
| - assert!(!html.contains(OWN), "the public markup named the sqid: {html}"); |
| + assert!( |
| + !html.contains(OWN), |
| + "the public markup named the sqid: {html}" |
| + ); |
| } |
| |
| #[test] |
| @@ -65,7 +75,10 @@ fn the_default_view_draws_every_image_as_missing() { |
| let src = own_src(); |
| let doc = with_image(&[("src", &src), ("alt", "A cat")]); |
| let html = docs_core::fragment_html(&doc); |
| - assert_eq!(html, "<p>Before <span class=\"docs-image-missing\">A cat</span> after</p>"); |
| + assert_eq!( |
| + html, |
| + "<p>Before <span class=\"docs-image-missing\">A cat</span> after</p>" |
| + ); |
| assert!(docs_core::fragment_json(&doc).contains("\"missing\":true")); |
| } |
| |
| @@ -90,7 +103,10 @@ fn anything_but_this_documents_own_address_is_missing() { |
| let doc = with_image(&[("src", &src), ("alt", "x")]); |
| let html = fragment_html_in(&doc, &signed_in()); |
| assert!(!html.contains("<img"), "{src:?} drew an image: {html}"); |
| - assert!(html.contains("<span class=\"docs-image-missing\">x</span>"), "{src:?}: {html}"); |
| + assert!( |
| + html.contains("<span class=\"docs-image-missing\">x</span>"), |
| + "{src:?}: {html}" |
| + ); |
| let json = fragment_json_in(&doc, &signed_in()); |
| assert!(json.contains("\"missing\":true"), "{src:?}: {json}"); |
| assert!(!json.contains("src"), "{src:?} reached JSON: {json}"); |
| @@ -141,7 +157,13 @@ fn sizes_are_digits_clamped_and_both_or_neither() { |
| #[test] |
| fn json_carries_only_the_checked_parts() { |
| let src = own_src(); |
| - let doc = with_image(&[("src", &src), ("alt", "A cat"), ("width", "640"), ("height", "480"), ("title", "t")]); |
| + let doc = with_image(&[ |
| + ("src", &src), |
| + ("alt", "A cat"), |
| + ("width", "640"), |
| + ("height", "480"), |
| + ("title", "t"), |
| + ]); |
| let json = fragment_json_in(&doc, &signed_in()); |
| assert!( |
| json.contains(&format!( |
| @@ -217,8 +239,9 @@ mod serde_json_lite { |
| fn reads_the_wire_vector() { |
| use yrs::updates::decoder::Decode; |
| let doc = Doc::with_options(Options::with_guid_and_client_id("fixture".into(), 1)); |
| - let update = yrs::Update::decode_v1(include_bytes!("../../fixtures/vectors/fragment/images.bin")) |
| - .expect("decode"); |
| + let update = |
| + yrs::Update::decode_v1(include_bytes!("../../fixtures/vectors/fragment/images.bin")) |
| + .expect("decode"); |
| doc.transact_mut().apply_update(update).expect("apply"); |
| let html = fragment_html_in(&doc, &signed_in()); |
| assert_eq!( |
| @@ -227,6 +250,9 @@ fn reads_the_wire_vector() { |
| <p><span class=\"docs-image-missing\">Pasted</span><span class=\"docs-image-missing\">Elsewhere</span></p>" |
| ); |
| let json = fragment_json_in(&doc, &signed_in()); |
| - assert!(json.contains("\"id\":\"fedcba9876543210\",\"alt\":\"\",\"width\":320,\"height\":200"), "{json}"); |
| + assert!( |
| + json.contains("\"id\":\"fedcba9876543210\",\"alt\":\"\",\"width\":320,\"height\":200"), |
| + "{json}" |
| + ); |
| assert!(!json.contains("data:"), "{json}"); |
| } |