Skip to content

Commit 3ffbc97

Browse files
committed
skipInvalidColor test
1 parent 1f14d7d commit 3ffbc97

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,6 +3057,37 @@ public void skipJBossIssue() throws Exception {
30573057
* @throws Exception if any error occurs
30583058
*/
30593059
@Test
3060+
public void skipInvalidColor() throws Exception {
3061+
final String css = ".test {\n"
3062+
+ " display: block;"
3063+
+ " color: rgb(10; 20, 30);';"
3064+
+ " align: left;"
3065+
+ "}\n"
3066+
+ ".another { display: none };";
3067+
3068+
final InputSource source = new InputSource(new StringReader(css));
3069+
final CSSOMParser parser = new CSSOMParser();
3070+
3071+
final ErrorHandler errorHandler = new ErrorHandler();
3072+
parser.setErrorHandler(errorHandler);
3073+
3074+
final CSSStyleSheetImpl sheet = parser.parseStyleSheet(source, null);
3075+
3076+
assertEquals(3, errorHandler.getErrorCount());
3077+
assertEquals(0, errorHandler.getFatalErrorCount());
3078+
assertEquals(2, errorHandler.getWarningCount());
3079+
3080+
final CSSRuleListImpl rules = sheet.getCssRules();
3081+
3082+
assertEquals(2, rules.getLength());
3083+
3084+
assertEquals("*.test { display: block; }", rules.getRules().get(0).getCssText());
3085+
assertEquals("*.another { display: none; }", rules.getRules().get(1).getCssText());
3086+
}
3087+
/**
3088+
* @throws Exception if any error occurs
3089+
*/
3090+
@Test
30603091
public void dimensionPercent() throws Exception {
30613092
final CSSValueImpl value = dimension("2%");
30623093
assertEquals(CSSPrimitiveValueType.CSS_PERCENTAGE, value.getPrimitiveType());

0 commit comments

Comments
 (0)