Skip to content

Commit 2b676c2

Browse files
committed
fix typo when skipping a rule with containing values with em unit (fixes #16)
1 parent 2fb51af commit 2b676c2

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ String skipUnit() {
22822282
JAVACODE
22832283
void appendUnit(Token t, StringBuilder sb) {
22842284
if (t.kind == EMS) {
2285-
sb.append("ems");
2285+
sb.append("em");
22862286
return;
22872287
}
22882288
if (t.kind == REM) {

src/test/java/com/gargoylesoftware/css/dom/CSSUnknownRuleImplTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ public void setCssText() throws Exception {
5757

5858
}
5959

60+
/**
61+
* @throws Exception if any error occurs
62+
*/
63+
@Test
64+
public void keyframes() throws Exception {
65+
final CSSUnknownRuleImpl value = parseUnknownRule("@keyframes load5 {0%, 100% {"
66+
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
67+
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
68+
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
69+
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
70+
+ "}");
71+
72+
assertEquals("@keyframes load5 {0%, 100% {"
73+
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
74+
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
75+
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
76+
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
77+
+ "}", value.getCssText());
78+
assertEquals("@keyframes load5 {0%, 100% {"
79+
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
80+
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
81+
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
82+
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
83+
+ "}", value.toString());
84+
}
85+
6086
/**
6187
* @throws Exception if any error occurs
6288
*/

0 commit comments

Comments
 (0)