@@ -1128,6 +1128,10 @@ public void hslComma() throws Exception {
11281128 color ("foreground: hsl(255grad, 0%, 15.37%)" , "foreground: hsl(2.55e2grad, 0e0%, 1537e-2%)" );
11291129 color ("foreground: hsl(255turn, 0%, 15.37%)" , "foreground: hsl(2.55e2turn, 0e0%, 1537e-2%)" );
11301130
1131+ color ("foreground: hsl(none 0% 60%)" , "foreground: hsl(none 0% 60%)" );
1132+ color ("foreground: hsl(100deg none 60%)" , "foreground: hsl(100deg none 60%)" );
1133+ color ("foreground: hsl(100deg 0% none)" , "foreground: hsl(100deg 0% none)" );
1134+
11311135 // alpha
11321136 color ("foreground: hsl(270, 60%, 70%, 0.1)" , "foreground: hsl(270,60%,70%,0.1)" );
11331137 color ("foreground: hsl(-270, 60%, 70%, 0.1)" , "foreground: hsl(-270, 60%, 70%, 0.1)" );
@@ -1160,6 +1164,18 @@ public void hslBlank() throws Exception {
11601164 color ("foreground: hsl(-270 60% 70% / 10%)" , "foreground: hsl(-270 60% 70% / 10%)" );
11611165 }
11621166
1167+ /**
1168+ * @throws Exception in case of failure
1169+ */
1170+ @ Test
1171+ public void hslMixed () throws Exception {
1172+ color ("foreground: hsl(42, 128%, 255%)" , "foreground: hsl(42, 128%, 255%)" );
1173+ color ("foreground: hsl(42deg, 128%, 255%)" , "foreground: hsl(42deg, 128%, 255%)" );
1174+
1175+ color ("foreground: hsl(42 128% 255%)" , "foreground: hsl(42 128% 255%)" );
1176+ color ("foreground: hsl(42rad 128% 255%)" , "foreground: hsl(42rad 128% 255%)" );
1177+ }
1178+
11631179 /**
11641180 * @throws Exception in case of failure
11651181 */
@@ -1210,6 +1226,18 @@ public void hslaBlank() throws Exception {
12101226 color ("foreground: hsla(-270 60% 70% / 10%)" , "foreground: hsla(-270 60% 70% / 10%)" );
12111227 }
12121228
1229+ /**
1230+ * @throws Exception in case of failure
1231+ */
1232+ @ Test
1233+ public void hslaMixed () throws Exception {
1234+ color ("foreground: hsla(42, 128%, 255%)" , "foreground: hsla(42, 128%, 255%)" );
1235+ color ("foreground: hsla(42deg, 128%, 255%)" , "foreground: hsla(42deg, 128%, 255%)" );
1236+
1237+ color ("foreground: hsla(42 128% 255%)" , "foreground: hsla(42 128% 255%)" );
1238+ color ("foreground: hsla(42rad 128% 255%)" , "foreground: hsla(42rad 128% 255%)" );
1239+ }
1240+
12131241 /**
12141242 * @throws Exception in case of failure
12151243 */
@@ -1218,17 +1246,47 @@ public void hslVariousErrors() throws Exception {
12181246 color (1 , "DOM exception: 'hsl parameters must be separated by ','.'" , "foreground: hsl(10, 20% 30%)" );
12191247 color (1 , "DOM exception: 'hsl requires consitent separators (blank or comma).'" , "foreground: hsl(10 20%, 30%)" );
12201248
1221- color (1 , "Error in expression. (Invalid token \" 10\" . "
1222- + "Was expecting one of: <S>, <NUMBER>, \" -\" , \" +\" , <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)" ,
1223- "foreground: hsl('10', 20% 30%)" );
1224- color (1 , "Error in expression. (Invalid token \" 10\" . "
1225- + "Was expecting one of: <S>, <NUMBER>, \" -\" , \" +\" , <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)" ,
1226- "foreground: hsl(10px, 20% 30%)" );
1227-
1228- color (1 , "Error in expression. (Invalid token \" 20\" . Was expecting one of: <S>, \" -\" , \" +\" , <PERCENTAGE>.)" ,
1229- "foreground: hsl(10, 20, 30%)" );
1230- color (1 , "Error in expression. (Invalid token \" 30\" . Was expecting one of: <S>, \" -\" , \" +\" , <PERCENTAGE>.)" ,
1231- "foreground: hsl(10, 20%, 30)" );
1249+ color (1 , "DOM exception: 'hsl alpha value must be separated by '/'.'" , "foreground: hsl(10 20% 30% 40)" );
1250+
1251+ color (1 , "DOM exception: 'hsl has to use blank as separator if none is used.'" , "foreground: hsl(none, 20%, 30%)" );
1252+ color (1 , "DOM exception: 'hsl has to use blank as separator if none is used.'" , "foreground: hsl(10, none, 30%)" );
1253+ color (1 , "DOM exception: 'hsl has to use blank as separator if none is used.'" , "foreground: hsl(10, 20%, none)" );
1254+ color (1 , "DOM exception: 'hsl has to use blank as separator if none is used.'" , "foreground: hsl(10, 20%, 30%, none)" );
1255+
1256+ // mixing numbers and percentages is supported by current browsers
1257+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20, 30)");
1258+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20%, 30)");
1259+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20%, 30)");
1260+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20%, 30%)");
1261+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20, 30%)");
1262+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20, 30%)");
1263+ //
1264+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20 30)");
1265+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20% 30)");
1266+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20% 30)");
1267+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20% 30%)");
1268+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20 30%)");
1269+ // color(1, "DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20 30%)");
1270+
1271+ color (1 , "Error in expression. (Invalid token \" )\" . Was expecting one of: <S>, <NUMBER>, \" none\" , \" -\" , \" +\" , <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)" ,
1272+ "foreground: hsl()" );
1273+ color (1 , "Error in expression. (Invalid token \" )\" . Was expecting one of: <S>, \" none\" , \" -\" , \" +\" , \" ,\" , <PERCENTAGE>.)" ,
1274+ "foreground: hsl(10)" );
1275+ color (1 , "Error in expression. (Invalid token \" )\" . Was expecting one of: <S>, \" none\" , \" -\" , \" +\" , \" ,\" , <PERCENTAGE>.)" ,
1276+ "foreground: hsl(10 20%)" );
1277+
1278+ color (1 , "Error in expression. (Invalid token \" )\" . Was expecting one of: <S>, <NUMBER>, \" none\" , \" -\" , \" +\" , <PERCENTAGE>.)" ,
1279+ "foreground: hsl(10, 20%, 30%,)" );
1280+ color (1 , "Error in expression. (Invalid token \" )\" . Was expecting one of: <S>, <NUMBER>, \" none\" , \" -\" , \" +\" , <PERCENTAGE>.)" ,
1281+ "foreground: hsl(10, 20%, 30%/)" );
1282+
1283+ color (1 , "Error in expression. (Invalid token \" 20\" . Was expecting one of: <S>, \" none\" , \" -\" , \" +\" , <PERCENTAGE>.)" ,
1284+ "foreground: hsl(10, 20px, 30)" );
1285+ color (1 , "Error in expression. (Invalid token \" 20\" . Was expecting one of: <S>, \" none\" , \" -\" , \" +\" , \" ,\" , <PERCENTAGE>.)" ,
1286+ "foreground: hsl(10 20px 30)" );
1287+
1288+ color (1 , "Error in expression. (Invalid token \" 10\" . Was expecting one of: <S>, <NUMBER>, \" none\" , \" -\" , \" +\" , <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)" ,
1289+ "foreground: hsl('10', 20, 30,)" );
12321290 }
12331291
12341292 private void color (final String expected , final String cssText ) throws Exception {
0 commit comments