Skip to content

Commit

Permalink
fix typo when skipping a rule with containing values with em unit (fixes
Browse files Browse the repository at this point in the history
 #16)
  • Loading branch information
rbri committed Dec 28, 2022
1 parent 2fb51af commit 2b676c2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/javacc/CSS3Parser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ String skipUnit() {
JAVACODE
void appendUnit(Token t, StringBuilder sb) {
if (t.kind == EMS) {
sb.append("ems");
sb.append("em");
return;
}
if (t.kind == REM) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,32 @@ public void setCssText() throws Exception {

}

/**
* @throws Exception if any error occurs
*/
@Test
public void keyframes() throws Exception {
final CSSUnknownRuleImpl value = parseUnknownRule("@keyframes load5 {0%, 100% {"
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
+ "}");

assertEquals("@keyframes load5 {0%, 100% {"
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
+ "}", value.getCssText());
assertEquals("@keyframes load5 {0%, 100% {"
+ "box-shadow: 0em -2.6em 0em 0em #000000, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2), "
+ "0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), "
+ "-2.6em 0em 0 0em rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.7);"
+ "}", value.toString());
}

/**
* @throws Exception if any error occurs
*/
Expand Down

0 comments on commit 2b676c2

Please sign in to comment.