Skip to content

Commit 5994471

Browse files
committed
simplify and more detailed tests
1 parent e7fe39d commit 5994471

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TOKEN_MGR_DECLS :
103103
// {s} {return S;}
104104
< S: ( " "|"\t"|"\r"|"\n"|"\f" )+ >
105105
// w {s}?
106-
| < W: ( <S> )? >
106+
// | < W: ( <S> )? >
107107
}
108108

109109
<DEFAULT> MORE :
@@ -315,7 +315,7 @@ TOKEN_MGR_DECLS :
315315
| < CHARSET_SYM: "@" <C_LETTER> <H_LETTER> <A_LETTER> <R_LETTER> <S_LETTER> <E_LETTER> <T_LETTER> >
316316

317317
// "!"({w}|{comment})*{I}{M}{P}{O}{R}{T}{A}{N}{T} {return IMPORTANT_SYM;}
318-
| < IMPORTANT_SYM: "!" ( <W> | <COMMENT_> )* <I_LETTER> <M_LETTER> <P_LETTER> <O_LETTER> <R_LETTER> <T_LETTER> <A_LETTER> <N_LETTER> <T_LETTER> >
318+
| < IMPORTANT_SYM: "!" ( <S> | <COMMENT_> )* <I_LETTER> <M_LETTER> <P_LETTER> <O_LETTER> <R_LETTER> <T_LETTER> <A_LETTER> <N_LETTER> <T_LETTER> >
319319

320320
// {num}{E}{M} {return EMS;}
321321
| < EMS: <NUM> <E_LETTER> <M_LETTER> > { matchedToken.image = ParserUtils.trimBy(image, 0, 2); }

src/test/java/org/htmlunit/cssparser/parser/ImportantTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private void css() throws Exception {
7171
assertEquals(0, errorHandler.getWarningCount());
7272

7373
final CSSRuleListImpl rules = ss.getCssRules();
74-
assertEquals(5, rules.getLength());
74+
assertEquals(7, rules.getLength());
7575

7676
AbstractCSSRuleImpl rule = rules.getRules().get(0);
7777
assertEquals("*.sel1 { padding: 0 !important; }", rule.getCssText());
@@ -86,6 +86,12 @@ private void css() throws Exception {
8686
assertEquals("*.sel4 { font-weight: normal !important; }", rule.getCssText());
8787

8888
rule = rules.getRules().get(4);
89+
assertEquals("*.sel5 { font-weight: normal !important; }", rule.getCssText());
90+
91+
rule = rules.getRules().get(5);
92+
assertEquals("*.sel6 { font-weight: normal !important; }", rule.getCssText());
93+
94+
rule = rules.getRules().get(6);
8995
assertEquals("*.important { font-weight: bold; }", rule.getCssText());
9096
}
9197

src/test/resources/important.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
important;
1313
}
1414

15+
.sel5 {
16+
font-weight: normal !/*really*/important;
17+
}
18+
19+
.sel6 {
20+
font-weight: normal ! /*really*/ important;
21+
}
22+
1523
.important {
1624
font-weight: bold
1725
}

0 commit comments

Comments
 (0)