From 2ca9f043e4b007139a8827dffe8c5e93fbaa3b5a Mon Sep 17 00:00:00 2001
From: uncenter <47499684+uncenter@users.noreply.github.com>
Date: Fri, 15 Nov 2024 08:54:54 -0500
Subject: [PATCH] Add tests for convert_fontawesome
---
src/renderer/html_handlebars/hbs_renderer.rs | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs
index 2de421290b..1c5d290012 100644
--- a/src/renderer/html_handlebars/hbs_renderer.rs
+++ b/src/renderer/html_handlebars/hbs_renderer.rs
@@ -1322,4 +1322,29 @@ mod tests {
assert_eq!(json!(TextDirection::RightToLeft), json!("rtl"));
assert_eq!(json!(TextDirection::LeftToRight), json!("ltr"));
}
+
+ #[test]
+ fn convert_valid_fontawesome_class() {
+ assert!(convert_fontawesome("").contains("class=\"fa-svg\""));
+ assert!(
+ convert_fontawesome("")
+ .contains("class=\"fa-svg some-class\"")
+ );
+ assert!(convert_fontawesome("").contains("class=\"fa-svg\""));
+ assert!(convert_fontawesome("").contains("class=\"fa-svg\""));
+ }
+
+ #[test]
+ fn convert_invalid_fontawesome_class() {
+ let invalid_fontawesome_i_tag = "";
+ assert_eq!(
+ convert_fontawesome(invalid_fontawesome_i_tag),
+ invalid_fontawesome_i_tag
+ );
+ let non_fontawesome_i_tag = "";
+ assert_eq!(
+ convert_fontawesome(non_fontawesome_i_tag),
+ non_fontawesome_i_tag
+ );
+ }
}