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 2021/11/22 12:48:29 UTC
[myfaces-tobago] branch tobago-5.x updated: fix: icon regex pattern
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 aea77e9 fix: icon regex pattern
aea77e9 is described below
commit aea77e9a16245e302583852c5c1e09e262ca6f4d
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Nov 22 13:32:34 2021 +0100
fix: icon regex pattern
Regex patten doesn't recognize 'fa-angle-left' as a fontawesome icon.
---
.../main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java | 8 ++++----
.../org/apache/myfaces/tobago/renderkit/css/IconsUnitTest.java | 6 ++++++
2 files changed, 10 insertions(+), 4 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 e200793..5bf7147 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
@@ -53,10 +53,10 @@ public enum Icons implements CssItem {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static final Pattern PATTERN = Pattern.compile("^(bi|fa|(fas|far|fal|fad)\\sfa)-[\\w\\d]+$");
- 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 = Pattern.compile("^(bi|fa|(fas|far|fal|fad)\\sfa)-[\\w\\d-]+$");
+ 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 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 31aacf9..07f7be6 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
@@ -61,6 +61,12 @@ public class IconsUnitTest {
}
@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());