|
57 | 57 | import org.htmlunit.cssparser.parser.selector.Selector; |
58 | 58 | import org.htmlunit.cssparser.parser.selector.Selector.SelectorType; |
59 | 59 | import org.htmlunit.cssparser.parser.selector.SelectorList; |
| 60 | +import org.junit.jupiter.api.Assertions; |
60 | 61 | import org.junit.jupiter.api.Test; |
61 | 62 |
|
62 | 63 | /** |
@@ -1271,6 +1272,15 @@ public void hslVariousErrors() throws Exception { |
1271 | 1272 | color(1, "DOM exception: ''hsl' has to use blank as separator if none is used.'", "foreground: hsl(10, 20%, none)"); |
1272 | 1273 | color(1, "DOM exception: ''hsl' has to use blank as separator if none is used.'", "foreground: hsl(10, 20%, 30%, none)"); |
1273 | 1274 |
|
| 1275 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)", |
| 1276 | + "foreground: hsl(-none 20% 30%)"); |
| 1277 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", \",\", <PERCENTAGE>.)", |
| 1278 | + "foreground: hsl(10 -none 30%)"); |
| 1279 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", \",\", <PERCENTAGE>.)", |
| 1280 | + "foreground: hsl(10 20% -none)"); |
| 1281 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", |
| 1282 | + "foreground: hsl(10 20% 30% / -none)"); |
| 1283 | + |
1274 | 1284 | // mixing numbers and percentages is supported by current browsers |
1275 | 1285 | // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20, 30)"); |
1276 | 1286 | // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20%, 30)"); |
@@ -1349,6 +1359,15 @@ public void hwbVariousErrors() throws Exception { |
1349 | 1359 |
|
1350 | 1360 | color(1, "DOM exception: ''hwb' alpha value must be separated by '/'.'", "foreground: hwb(10 20% 30% 40)"); |
1351 | 1361 |
|
| 1362 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)", |
| 1363 | + "foreground: hwb(-none 20% 30%)"); |
| 1364 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", |
| 1365 | + "foreground: hwb(10 -none 30%)"); |
| 1366 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", |
| 1367 | + "foreground: hwb(10 20% -none)"); |
| 1368 | + color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", |
| 1369 | + "foreground: hwb(10 20% 30% / -none)"); |
| 1370 | + |
1352 | 1371 | color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)", |
1353 | 1372 | "foreground: hwb()"); |
1354 | 1373 | color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", |
@@ -1693,6 +1712,9 @@ private void color(final int errorCount, final String expected, final String css |
1693 | 1712 |
|
1694 | 1713 | final CSSStyleDeclarationImpl style = parser.parseStyleDeclaration(cssText); |
1695 | 1714 |
|
| 1715 | + if (errorCount == 0 && errorHandler.getErrorCount() > 0) { |
| 1716 | + Assertions.fail("Found errors; First: " + errorHandler.getErrorMessage()); |
| 1717 | + } |
1696 | 1718 | assertEquals(errorCount, errorHandler.getErrorCount()); |
1697 | 1719 | if (errorCount > 0) { |
1698 | 1720 | assertEquals(expected, errorHandler.getErrorMessage()); |
|
0 commit comments