use ruma_html::{ remove_html_reply_fallback, sanitize_html, HtmlSanitizerMode, RemoveReplyFallback, }; #[test] fn sanitize() { let sanitized = sanitize_html( "\ \
\ In reply to \ @alice:example.com\
\ Previous message\
\
\ This has no tag\

But this is inside a tag

\ ", HtmlSanitizerMode::Strict, RemoveReplyFallback::No, ); assert_eq!( sanitized, "\ \
\ In reply to \ @alice:example.com\
\ Previous message\
\
\ This has no tag\

But this is inside a tag

\ " ); } #[test] fn sanitize_without_reply() { let sanitized = sanitize_html( "\ \
\ In reply to \ @alice:example.com\
\ Previous message\
\
\ This has no tag\

But this is inside a tag

\ ", HtmlSanitizerMode::Strict, RemoveReplyFallback::Yes, ); assert_eq!( sanitized, "\ This has no tag\

But this is inside a tag

\ " ); } #[test] fn remove_html_reply() { let without_reply = remove_html_reply_fallback( "\ \
\ In reply to \ @alice:example.com\
\ Previous message\
\
\ This keeps its tag\

But this is inside a tag

\ ", ); assert_eq!( without_reply, "\ This keeps its tag\

But this is inside a tag

\ " ); }