You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2024/03/27 08:10:27 UTC
(myfaces-tobago) branch tobago-5.x updated: fix: FontAwesome 5
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/tobago-5.x by this push:
new ed8444da80 fix: FontAwesome 5
ed8444da80 is described below
commit ed8444da80ed7b121ff38028f12d1ce1346ccdd0
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Mar 27 09:00:28 2024 +0100
fix: FontAwesome 5
* fix FA 5 "fab fa-elementor"
* refactor unit test
* refactor FA6: use \\s instead of 'space' for FA6 pattern
Issue: TOBAGO-2296
---
.../apache/myfaces/tobago/renderkit/css/Icons.java | 4 +--
.../tobago/renderkit/css/IconsUnitTest.java | 36 +++-------------------
2 files changed, 7 insertions(+), 33 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java
index c0c3900582..d89a12f18f 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java
@@ -55,9 +55,9 @@ public enum Icons implements CssItem {
private static final Pattern PATTERN_BI = Pattern.compile("^bi-[\\w\\d-]+$");
private static final Pattern PATTERN_FA = Pattern.compile("^fa-[\\w\\d-]+$");
- private static final Pattern PATTERN_FA5 = Pattern.compile("^(fas|far|fal|fad)\\sfa-[\\w\\d-]+$");
+ private static final Pattern PATTERN_FA5 = Pattern.compile("^(fas|far|fal|fad|fab)\\sfa-[\\w\\d-]+$");
private static final Pattern PATTERN_FA6 =
- Pattern.compile("^(fa-sharp )?fa-(solid|regular|light|duotone|thin) fa-[\\w\\d-]+$");
+ Pattern.compile("^(fa-sharp\\s)?fa-(solid|regular|light|duotone|thin)\\sfa-[\\w\\d-]+$");
private final String clazz;
diff --git a/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/css/IconsUnitTest.java b/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/css/IconsUnitTest.java
index 03b449ad32..9ab917b30b 100644
--- a/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/css/IconsUnitTest.java
+++ b/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/css/IconsUnitTest.java
@@ -25,63 +25,37 @@ import org.junit.jupiter.api.Test;
public class IconsUnitTest {
@Test
- public void iconBi() {
+ public void bootstrapIcons() {
Assertions.assertTrue(Icons.matches("bi-code"));
Assertions.assertEquals("bi-code", Icons.custom("bi-code").getName());
- }
-
- @Test
- public void iconBiJpg() {
Assertions.assertFalse(Icons.matches("bi-code.jpg"));
Assertions.assertNull(Icons.custom("bi-code.jpg").getName());
}
@Test
- public void iconFa() {
+ public void iconFontawesome4() {
Assertions.assertTrue(Icons.matches("fa-code"));
Assertions.assertEquals("fa fa-code", Icons.custom("fa-code").getName());
- }
-
- @Test
- public void iconFx() {
Assertions.assertFalse(Icons.matches("fx-code"));
Assertions.assertNull(Icons.custom("fx-code").getName());
}
@Test
- public void iconFas() {
+ public void iconFontawesome5() {
Assertions.assertTrue(Icons.matches("fas fa-code"));
Assertions.assertEquals("fas fa-code", Icons.custom("fas fa-code").getName());
- }
-
- @Test
- public void iconFar() {
Assertions.assertTrue(Icons.matches("far fa-code"));
Assertions.assertEquals("far fa-code", Icons.custom("far fa-code").getName());
- }
-
- @Test
- public void iconFarFaAngleLeft() {
Assertions.assertTrue(Icons.matches("far fa-angle-left"));
Assertions.assertEquals("far fa-angle-left", Icons.custom("far fa-angle-left").getName());
- }
-
- @Test
- public void iconFal() {
Assertions.assertTrue(Icons.matches("fal fa-code"));
Assertions.assertEquals("fal fa-code", Icons.custom("fal fa-code").getName());
- }
-
- @Test
- public void iconFad() {
Assertions.assertTrue(Icons.matches("fad fa-code"));
Assertions.assertEquals("fad fa-code", Icons.custom("fad fa-code").getName());
- }
-
- @Test
- public void iconFax() {
Assertions.assertFalse(Icons.matches("fax fa-code"));
Assertions.assertNull(Icons.custom("fax fa-code").getName());
+ Assertions.assertTrue(Icons.matches("fab fa-elementor"));
+ Assertions.assertEquals("fab fa-elementor", Icons.custom("fab fa-elementor").getName());
}
@Test