Skip to content

Commit bc1ecaa

Browse files
authored
Merge pull request #222 from CSSLint/text-decoration-update
Update text-decoration (-style, -line, -color) definition
2 parents 3654156 + b1c9ec2 commit bc1ecaa

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

src/css/Properties.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ var Properties = module.exports = {
426426
"text-align" : "left | right | center | justify | match-parent | start | end",
427427
"text-align-last" : 1,
428428
"text-anchor" : "start | middle | end",
429-
"text-decoration" : "<text-decoration>",
429+
"text-decoration" : "<text-decoration-line> || <text-decoration-style> || <text-decoration-color>",
430+
"text-decoration-color" : "<text-decoration-color>",
431+
"text-decoration-line" : "<text-decoration-line>",
432+
"text-decoration-style" : "<text-decoration-style>",
430433
"text-emphasis" : 1,
431434
"text-height" : 1,
432435
"text-indent" : "<length> | <percentage>",

src/css/ValidationTypes.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,15 @@ copy(ValidationTypes, {
433433
Matcher.many([true /* length is required */],
434434
Matcher.cast("<length>").braces(2, 4), "inset", "<color>"),
435435

436-
"<text-decoration>":
436+
"<text-decoration-color>":
437+
"<color>",
438+
439+
"<text-decoration-line>":
437440
"none | [ underline || overline || line-through || blink ]",
438441

442+
"<text-decoration-style>":
443+
"solid | double | dotted | dashed | wavy",
444+
439445
"<will-change>":
440446
"auto | <animateable-feature>#",
441447

tests/css/Validation.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,45 @@ var YUITest = require("yuitest"),
13871387
suite.add(new ValidationTestCase({
13881388
property: "text-decoration",
13891389

1390+
valid: [
1391+
"none",
1392+
"underline red",
1393+
"underline wavy red",
1394+
"wavy",
1395+
"wavy red",
1396+
"red"
1397+
],
1398+
1399+
invalid: {
1400+
"underline underline" : "Expected end of value but found 'underline'.",
1401+
"underline wavy dotted": "Expected end of value but found 'dotted'.",
1402+
"underline wavy red purple": "Expected end of value but found 'purple'.",
1403+
"wavy dotted": "Expected end of value but found 'dotted'.",
1404+
"wavy red purple": "Expected end of value but found 'purple'.",
1405+
"red purple": "Expected end of value but found 'purple'.",
1406+
"foo" : "Expected (<text-decoration-line> || <text-decoration-style> || <text-decoration-color>) but found 'foo'."
1407+
}
1408+
}));
1409+
1410+
suite.add(new ValidationTestCase({
1411+
property: "text-decoration-color",
1412+
1413+
valid: [
1414+
"red",
1415+
"#f00",
1416+
"transparent",
1417+
"rgba(255, 128, 128, 0.5)"
1418+
],
1419+
1420+
invalid: {
1421+
"foo" : "Expected (<color>) but found 'foo'.",
1422+
"invert" : "Expected (<color>) but found 'invert'."
1423+
}
1424+
}));
1425+
1426+
suite.add(new ValidationTestCase({
1427+
property: "text-decoration-line",
1428+
13901429
valid: [
13911430
"none",
13921431
"underline",
@@ -1402,6 +1441,23 @@ var YUITest = require("yuitest"),
14021441
}
14031442
}));
14041443

1444+
suite.add(new ValidationTestCase({
1445+
property: "text-decoration-style",
1446+
1447+
valid: [
1448+
"solid",
1449+
"double",
1450+
"dotted",
1451+
"dashed",
1452+
"wavy"
1453+
],
1454+
1455+
invalid: {
1456+
"solid double" : "Expected end of value but found 'double'.",
1457+
"foo" : "Expected (solid | double | dotted | dashed | wavy) but found 'foo'."
1458+
}
1459+
}));
1460+
14051461
suite.add(new ValidationTestCase({
14061462
property: "text-rendering",
14071463

0 commit comments

Comments
 (0)