ruby_css_lint 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +71 -0
- data/VERSION +1 -0
- data/csslint/CHANGELOG +286 -0
- data/csslint/LICENSE +20 -0
- data/csslint/README.md +25 -0
- data/csslint/build.xml +242 -0
- data/csslint/demos/CSSLintDemo.htm +105 -0
- data/csslint/demos/demo.css +43 -0
- data/csslint/lib/js.jar +0 -0
- data/csslint/lib/jshint.js +3963 -0
- data/csslint/lib/parserlib.js +6295 -0
- data/csslint/lib/yuitest-rhino-cli.js +3955 -0
- data/csslint/lib/yuitest.js +4561 -0
- data/csslint/npm/package.json +30 -0
- data/csslint/release/csslint-node.js +9125 -0
- data/csslint/release/csslint-rhino.js +9390 -0
- data/csslint/release/csslint-tests.js +1921 -0
- data/csslint/release/csslint-worker.js +9148 -0
- data/csslint/release/csslint-wsh.js +9477 -0
- data/csslint/release/csslint.js +9127 -0
- data/csslint/release/npm/cli.js +307 -0
- data/csslint/release/npm/lib/csslint-node.js +9125 -0
- data/csslint/release/npm/package.json +30 -0
- data/csslint/src/cli/common.js +215 -0
- data/csslint/src/cli/node.js +87 -0
- data/csslint/src/cli/rhino.js +47 -0
- data/csslint/src/cli/wsh.js +134 -0
- data/csslint/src/core/CSSLint.js +181 -0
- data/csslint/src/core/Reporter.js +161 -0
- data/csslint/src/core/Util.js +62 -0
- data/csslint/src/formatters/checkstyle-xml.js +109 -0
- data/csslint/src/formatters/compact.js +59 -0
- data/csslint/src/formatters/csslint-xml.js +68 -0
- data/csslint/src/formatters/lint-xml.js +69 -0
- data/csslint/src/formatters/text.js +64 -0
- data/csslint/src/rules/adjoining-classes.js +45 -0
- data/csslint/src/rules/box-model.js +93 -0
- data/csslint/src/rules/box-sizing.js +28 -0
- data/csslint/src/rules/compatible-vendor-prefixes.js +171 -0
- data/csslint/src/rules/display-property-grouping.js +117 -0
- data/csslint/src/rules/duplicate-background-images.js +37 -0
- data/csslint/src/rules/duplicate-properties.js +46 -0
- data/csslint/src/rules/empty-rules.js +34 -0
- data/csslint/src/rules/errors.js +23 -0
- data/csslint/src/rules/fallback-colors.js +67 -0
- data/csslint/src/rules/floats.js +36 -0
- data/csslint/src/rules/font-faces.js +30 -0
- data/csslint/src/rules/font-sizes.js +35 -0
- data/csslint/src/rules/gradients.js +69 -0
- data/csslint/src/rules/ids.js +50 -0
- data/csslint/src/rules/import.js +23 -0
- data/csslint/src/rules/important.js +37 -0
- data/csslint/src/rules/known-properties.js +29 -0
- data/csslint/src/rules/outline-none.js +73 -0
- data/csslint/src/rules/overqualified-elements.js +63 -0
- data/csslint/src/rules/qualified-headings.js +38 -0
- data/csslint/src/rules/regex-selectors.js +44 -0
- data/csslint/src/rules/rules-count.js +28 -0
- data/csslint/src/rules/shorthand.js +87 -0
- data/csslint/src/rules/star-property-hack.js +27 -0
- data/csslint/src/rules/text-indent.js +53 -0
- data/csslint/src/rules/underscore-property-hack.js +27 -0
- data/csslint/src/rules/unique-headings.js +74 -0
- data/csslint/src/rules/universal-selector.js +35 -0
- data/csslint/src/rules/unqualified-attributes.js +42 -0
- data/csslint/src/rules/vendor-prefix.js +143 -0
- data/csslint/src/rules/zero-units.js +34 -0
- data/csslint/src/worker/Worker.js +26 -0
- data/csslint/tests/all-rules.js +64 -0
- data/csslint/tests/core/CSSLint.js +22 -0
- data/csslint/tests/core/Reporter.js +36 -0
- data/csslint/tests/css/width-100.html +76 -0
- data/csslint/tests/formatters/checkstyle-xml.js +44 -0
- data/csslint/tests/formatters/compact.js +47 -0
- data/csslint/tests/formatters/csslint-xml.js +42 -0
- data/csslint/tests/formatters/lint-xml.js +43 -0
- data/csslint/tests/formatters/text.js +36 -0
- data/csslint/tests/rules/adjoining-classes.js +31 -0
- data/csslint/tests/rules/box-model.js +211 -0
- data/csslint/tests/rules/box-sizing.js +23 -0
- data/csslint/tests/rules/compatible-vendor-prefixes.js +56 -0
- data/csslint/tests/rules/display-property-grouping.js +213 -0
- data/csslint/tests/rules/duplicate-background-images.js +25 -0
- data/csslint/tests/rules/duplicate-properties.js +54 -0
- data/csslint/tests/rules/empty-rules.js +18 -0
- data/csslint/tests/rules/errors.js +17 -0
- data/csslint/tests/rules/fallback-colors.js +162 -0
- data/csslint/tests/rules/floats.js +35 -0
- data/csslint/tests/rules/font-faces.js +28 -0
- data/csslint/tests/rules/font-sizes.js +30 -0
- data/csslint/tests/rules/gradients.js +60 -0
- data/csslint/tests/rules/ids.js +25 -0
- data/csslint/tests/rules/import.js +18 -0
- data/csslint/tests/rules/important.js +27 -0
- data/csslint/tests/rules/known-properties.js +44 -0
- data/csslint/tests/rules/outline-none.js +50 -0
- data/csslint/tests/rules/overqualified-elements.js +41 -0
- data/csslint/tests/rules/qualified-headings.js +19 -0
- data/csslint/tests/rules/regex-selectors.js +52 -0
- data/csslint/tests/rules/shorthand.js +36 -0
- data/csslint/tests/rules/star-property-hack.js +24 -0
- data/csslint/tests/rules/text-indent.js +55 -0
- data/csslint/tests/rules/underscore-property-hack.js +24 -0
- data/csslint/tests/rules/unique-headings.js +47 -0
- data/csslint/tests/rules/universal-selector.js +31 -0
- data/csslint/tests/rules/unqualified-attributes.js +37 -0
- data/csslint/tests/rules/vendor-prefix.js +76 -0
- data/csslint/tests/rules/zero-units.js +44 -0
- data/csslint/tests/testrunner.htm +138 -0
- data/js.jar +0 -0
- data/lib/ruby_css_lint.rb +168 -0
- data/test/helper.rb +17 -0
- data/test/test_ruby_css_lint.rb +7 -0
- metadata +240 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
/*global YUITest, CSSLint*/
|
4
|
+
var Assert = YUITest.Assert;
|
5
|
+
|
6
|
+
YUITest.TestRunner.add(new YUITest.TestCase({
|
7
|
+
|
8
|
+
name: "Box Model Rule Errors",
|
9
|
+
|
10
|
+
"Using width and padding should result in a warning": function(){
|
11
|
+
var result = CSSLint.verify(".foo { width: 100px; padding: 10px; }", { "box-model": 1 });
|
12
|
+
Assert.areEqual(1, result.messages.length);
|
13
|
+
Assert.areEqual("warning", result.messages[0].type);
|
14
|
+
Assert.areEqual("Using width with padding can sometimes make elements larger than you expect.", result.messages[0].message);
|
15
|
+
},
|
16
|
+
|
17
|
+
"Using width when padding is zero should not result in a warning": function(){
|
18
|
+
var result = CSSLint.verify(".foo { width: 100px; padding: 0; }", { "box-model": 1 });
|
19
|
+
Assert.areEqual(0, result.messages.length);
|
20
|
+
},
|
21
|
+
|
22
|
+
"Using width and padding-left should result in a warning": function(){
|
23
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-left: 10px; }", { "box-model": 1 });
|
24
|
+
Assert.areEqual(1, result.messages.length);
|
25
|
+
Assert.areEqual("warning", result.messages[0].type);
|
26
|
+
Assert.areEqual("Using width with padding-left can sometimes make elements larger than you expect.", result.messages[0].message);
|
27
|
+
},
|
28
|
+
|
29
|
+
"Using width when padding-left is zero should not result in a warning": function(){
|
30
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-left: 0; }", { "box-model": 1 });
|
31
|
+
Assert.areEqual(0, result.messages.length);
|
32
|
+
},
|
33
|
+
|
34
|
+
"Using width and padding-right should result in a warning": function(){
|
35
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-right: 10px; }", { "box-model": 1 });
|
36
|
+
Assert.areEqual(1, result.messages.length);
|
37
|
+
Assert.areEqual("warning", result.messages[0].type);
|
38
|
+
Assert.areEqual("Using width with padding-right can sometimes make elements larger than you expect.", result.messages[0].message);
|
39
|
+
},
|
40
|
+
|
41
|
+
"Using width when padding-right is zero should not result in a warning": function(){
|
42
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-right: 0; }", { "box-model": 1 });
|
43
|
+
Assert.areEqual(0, result.messages.length);
|
44
|
+
},
|
45
|
+
|
46
|
+
"Using width and padding-top should not result in a warning": function(){
|
47
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-top: 10px; }", { "box-model": 1 });
|
48
|
+
Assert.areEqual(0, result.messages.length);
|
49
|
+
},
|
50
|
+
|
51
|
+
"Using width and padding-bottom should not result in a warning": function(){
|
52
|
+
var result = CSSLint.verify(".foo { width: 100px; padding-bottom: 10px; }", { "box-model": 1 });
|
53
|
+
Assert.areEqual(0, result.messages.length);
|
54
|
+
},
|
55
|
+
|
56
|
+
"Using width and padding-to-bottom should not result in a warning": function(){
|
57
|
+
var result = CSSLint.verify(".foo { width: 100px; padding: 10px 0; }", { "box-model": 1 });
|
58
|
+
Assert.areEqual(0, result.messages.length);
|
59
|
+
},
|
60
|
+
|
61
|
+
"Using width and border should result in a warning": function(){
|
62
|
+
var result = CSSLint.verify(".foo { width: 100px; border: 10px; }", { "box-model": 1 });
|
63
|
+
Assert.areEqual(1, result.messages.length);
|
64
|
+
Assert.areEqual("warning", result.messages[0].type);
|
65
|
+
Assert.areEqual("Using width with border can sometimes make elements larger than you expect.", result.messages[0].message);
|
66
|
+
},
|
67
|
+
|
68
|
+
"Using width and border-left should result in a warning": function(){
|
69
|
+
var result = CSSLint.verify(".foo { width: 100px; border-left: 10px; }", { "box-model": 1 });
|
70
|
+
Assert.areEqual(1, result.messages.length);
|
71
|
+
Assert.areEqual("warning", result.messages[0].type);
|
72
|
+
Assert.areEqual("Using width with border-left can sometimes make elements larger than you expect.", result.messages[0].message);
|
73
|
+
},
|
74
|
+
|
75
|
+
"Using width when border-left is zero should not result in a warning": function(){
|
76
|
+
var result = CSSLint.verify(".foo { width: 100px; border-left: 0; }", { "box-model": 1 });
|
77
|
+
Assert.areEqual(0, result.messages.length);
|
78
|
+
},
|
79
|
+
|
80
|
+
"Using width and border-right should result in a warning": function(){
|
81
|
+
var result = CSSLint.verify(".foo { width: 100px; border-right: 10px; }", { "box-model": 1 });
|
82
|
+
Assert.areEqual(1, result.messages.length);
|
83
|
+
Assert.areEqual("warning", result.messages[0].type);
|
84
|
+
Assert.areEqual("Using width with border-right can sometimes make elements larger than you expect.", result.messages[0].message);
|
85
|
+
},
|
86
|
+
|
87
|
+
"Using width when border-right is zero should not result in a warning": function(){
|
88
|
+
var result = CSSLint.verify(".foo { width: 100px; border-right: 0; }", { "box-model": 1 });
|
89
|
+
Assert.areEqual(0, result.messages.length);
|
90
|
+
},
|
91
|
+
|
92
|
+
"Using width and border-top should not result in a warning": function(){
|
93
|
+
var result = CSSLint.verify(".foo { width: 100px; border-top: 10px; }", { "box-model": 1 });
|
94
|
+
Assert.areEqual(0, result.messages.length);
|
95
|
+
},
|
96
|
+
|
97
|
+
"Using width and border-bottom should not result in a warning": function(){
|
98
|
+
var result = CSSLint.verify(".foo { width: 100px; border-bottom: 10px; }", { "box-model": 1 });
|
99
|
+
Assert.areEqual(0, result.messages.length);
|
100
|
+
},
|
101
|
+
|
102
|
+
"Using height and padding should result in a warning": function(){
|
103
|
+
var result = CSSLint.verify(".foo { height: 100px; padding: 10px; }", { "box-model": 1 });
|
104
|
+
Assert.areEqual(1, result.messages.length);
|
105
|
+
Assert.areEqual("warning", result.messages[0].type);
|
106
|
+
Assert.areEqual("Using height with padding can sometimes make elements larger than you expect.", result.messages[0].message);
|
107
|
+
},
|
108
|
+
|
109
|
+
"Using height when padding is zero should not result in a warning": function(){
|
110
|
+
var result = CSSLint.verify(".foo { height: 100px; padding: 0; }", { "box-model": 1 });
|
111
|
+
Assert.areEqual(0, result.messages.length);
|
112
|
+
},
|
113
|
+
|
114
|
+
"Using height and padding-left should not result in a warning": function(){
|
115
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-left: 10px; }", { "box-model": 1 });
|
116
|
+
Assert.areEqual(0, result.messages.length);
|
117
|
+
},
|
118
|
+
|
119
|
+
"Using height and padding-right should not result in a warning": function(){
|
120
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-right: 10px; }", { "box-model": 1 });
|
121
|
+
Assert.areEqual(0, result.messages.length);
|
122
|
+
},
|
123
|
+
|
124
|
+
"Using height and padding-left-right should not result in a warning": function(){
|
125
|
+
var result = CSSLint.verify(".foo { height: 100px; padding: 0 10px; }", { "box-model": 1 });
|
126
|
+
Assert.areEqual(0, result.messages.length);
|
127
|
+
},
|
128
|
+
|
129
|
+
"Using height and padding-top should result in a warning": function(){
|
130
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-top: 10px; }", { "box-model": 1 });
|
131
|
+
Assert.areEqual(1, result.messages.length);
|
132
|
+
Assert.areEqual("warning", result.messages[0].type);
|
133
|
+
Assert.areEqual("Using height with padding-top can sometimes make elements larger than you expect.", result.messages[0].message);
|
134
|
+
},
|
135
|
+
|
136
|
+
"Using height when padding-top is zero should not result in a warning": function(){
|
137
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-top: 0; }", { "box-model": 1 });
|
138
|
+
Assert.areEqual(0, result.messages.length);
|
139
|
+
},
|
140
|
+
|
141
|
+
"Using height and padding-bottom should result in a warning": function(){
|
142
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-bottom: 10px; }", { "box-model": 1 });
|
143
|
+
Assert.areEqual(1, result.messages.length);
|
144
|
+
Assert.areEqual("warning", result.messages[0].type);
|
145
|
+
Assert.areEqual("Using height with padding-bottom can sometimes make elements larger than you expect.", result.messages[0].message);
|
146
|
+
},
|
147
|
+
|
148
|
+
"Using height when padding-bottom is zero should not result in a warning": function(){
|
149
|
+
var result = CSSLint.verify(".foo { height: 100px; padding-bottom: 0; }", { "box-model": 1 });
|
150
|
+
Assert.areEqual(0, result.messages.length);
|
151
|
+
},
|
152
|
+
|
153
|
+
"Using height and border should result in a warning": function(){
|
154
|
+
var result = CSSLint.verify(".foo { height: 100px; border: 10px; }", { "box-model": 1 });
|
155
|
+
Assert.areEqual(1, result.messages.length);
|
156
|
+
Assert.areEqual("warning", result.messages[0].type);
|
157
|
+
Assert.areEqual("Using height with border can sometimes make elements larger than you expect.", result.messages[0].message);
|
158
|
+
},
|
159
|
+
|
160
|
+
"Using height and border: none should not result in a warning": function(){
|
161
|
+
var result = CSSLint.verify(".foo { height: 100px; border: none; }", { "box-model": 1 });
|
162
|
+
Assert.areEqual(0, result.messages.length);
|
163
|
+
},
|
164
|
+
|
165
|
+
"Using height and border: 0 should not result in a warning": function(){
|
166
|
+
var result = CSSLint.verify(".foo { height: 100px; border: 0; }", { "box-model": 1 });
|
167
|
+
Assert.areEqual(0, result.messages.length);
|
168
|
+
},
|
169
|
+
|
170
|
+
"Using height and border-left should not result in a warning": function(){
|
171
|
+
var result = CSSLint.verify(".foo { height: 100px; border-left: 10px; }", { "box-model": 1 });
|
172
|
+
Assert.areEqual(0, result.messages.length);
|
173
|
+
},
|
174
|
+
|
175
|
+
"Using height and border-right should not result in a warning": function(){
|
176
|
+
var result = CSSLint.verify(".foo { height: 100px; border-right: 10px; }", { "box-model": 1 });
|
177
|
+
Assert.areEqual(0, result.messages.length);
|
178
|
+
},
|
179
|
+
|
180
|
+
"Using height and border-top should result in a warning": function(){
|
181
|
+
var result = CSSLint.verify(".foo { height: 100px; border-top: 10px; }", { "box-model": 1 });
|
182
|
+
Assert.areEqual(1, result.messages.length);
|
183
|
+
Assert.areEqual("warning", result.messages[0].type);
|
184
|
+
Assert.areEqual("Using height with border-top can sometimes make elements larger than you expect.", result.messages[0].message);
|
185
|
+
},
|
186
|
+
|
187
|
+
"Using height when border-top is zero should not result in a warning": function(){
|
188
|
+
var result = CSSLint.verify(".foo { height: 100px; border-top: 0; }", { "box-model": 1 });
|
189
|
+
Assert.areEqual(0, result.messages.length);
|
190
|
+
},
|
191
|
+
|
192
|
+
"Using height and border-bottom should result in a warning": function(){
|
193
|
+
var result = CSSLint.verify(".foo { height: 100px; border-bottom: 10px; }", { "box-model": 1 });
|
194
|
+
Assert.areEqual(1, result.messages.length);
|
195
|
+
Assert.areEqual("warning", result.messages[0].type);
|
196
|
+
Assert.areEqual("Using height with border-bottom can sometimes make elements larger than you expect.", result.messages[0].message);
|
197
|
+
},
|
198
|
+
|
199
|
+
"Using height when border-bottom is zero should not result in a warning": function(){
|
200
|
+
var result = CSSLint.verify(".foo { height: 100px; border-bottom: 0px; }", { "box-model": 1 });
|
201
|
+
Assert.areEqual(0, result.messages.length);
|
202
|
+
},
|
203
|
+
|
204
|
+
"Using height when border-bottom is zero should not result in a warning": function(){
|
205
|
+
var result = CSSLint.verify(".foo { height: 100px; border-bottom: 0; }", { "box-model": 1 });
|
206
|
+
Assert.areEqual(0, result.messages.length);
|
207
|
+
}
|
208
|
+
|
209
|
+
}));
|
210
|
+
|
211
|
+
})();
|
@@ -0,0 +1,23 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
/*global YUITest, CSSLint*/
|
4
|
+
var Assert = YUITest.Assert;
|
5
|
+
|
6
|
+
YUITest.TestRunner.add(new YUITest.TestCase({
|
7
|
+
|
8
|
+
name: "Box Sizing Rule Errors",
|
9
|
+
|
10
|
+
"Using box-sizing should result in a warning": function(){
|
11
|
+
var result = CSSLint.verify(".foo { box-sizing: border-box; }", { "box-sizing": 1 });
|
12
|
+
Assert.areEqual(1, result.messages.length);
|
13
|
+
Assert.areEqual("warning", result.messages[0].type);
|
14
|
+
Assert.areEqual("The box-sizing property isn't supported in IE6 and IE7.", result.messages[0].message);
|
15
|
+
},
|
16
|
+
|
17
|
+
"No box-sizing should not result in a warning": function(){
|
18
|
+
var result = CSSLint.verify(".foo { width: 100px; padding: 0; }", { "box-sizing": 1 });
|
19
|
+
Assert.areEqual(0, result.messages.length);
|
20
|
+
}
|
21
|
+
}));
|
22
|
+
|
23
|
+
})();
|
@@ -0,0 +1,56 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
/*global YUITest, CSSLint*/
|
4
|
+
var Assert = YUITest.Assert;
|
5
|
+
|
6
|
+
YUITest.TestRunner.add(new YUITest.TestCase({
|
7
|
+
|
8
|
+
name: "Compatible Vendor Prefix Warnings",
|
9
|
+
|
10
|
+
"Using -webkit-border-radius should warn to also include -moz-border-radius.": function(){
|
11
|
+
var result = CSSLint.verify("h1 { -webkit-border-radius: 5px; }", { "compatible-vendor-prefixes": 1 });
|
12
|
+
Assert.areEqual(1, result.messages.length);
|
13
|
+
Assert.areEqual("warning", result.messages[0].type);
|
14
|
+
Assert.areEqual("The property -moz-border-radius is compatible with -webkit-border-radius and should be included as well.", result.messages[0].message);
|
15
|
+
Assert.areEqual(6, result.messages[0].col);
|
16
|
+
Assert.areEqual(1, result.messages[0].line);
|
17
|
+
},
|
18
|
+
|
19
|
+
"Using -webkit-transition and -moz-transition should warn to also include -o-transition and -ms-transition.": function(){
|
20
|
+
var result = CSSLint.verify("h1 { -webkit-transition: height 20px 1s; -moz-transition: height 20px 1s; }", { "compatible-vendor-prefixes": 1 });
|
21
|
+
Assert.areEqual(2, result.messages.length);
|
22
|
+
Assert.areEqual("warning", result.messages[0].type);
|
23
|
+
Assert.areEqual("The property -o-transition is compatible with -webkit-transition and -moz-transition and should be included as well.", result.messages[0].message);
|
24
|
+
Assert.areEqual(6, result.messages[0].col);
|
25
|
+
Assert.areEqual(1, result.messages[0].line);
|
26
|
+
Assert.areEqual("warning", result.messages[1].type);
|
27
|
+
Assert.areEqual("The property -ms-transition is compatible with -webkit-transition and -moz-transition and should be included as well.", result.messages[1].message);
|
28
|
+
Assert.areEqual(6, result.messages[1].col);
|
29
|
+
Assert.areEqual(1, result.messages[1].line);
|
30
|
+
|
31
|
+
},
|
32
|
+
|
33
|
+
"Using -webkit-transform should warn to also include -moz-transform, -ms-transform, and -o-transform.": function(){
|
34
|
+
var result = CSSLint.verify("div.box { -webkit-transform: translate(50px, 100px); }", { "compatible-vendor-prefixes": 3 });
|
35
|
+
Assert.areEqual(3, result.messages.length);
|
36
|
+
Assert.areEqual("warning", result.messages[0].type);
|
37
|
+
Assert.areEqual("The property -moz-transform is compatible with -webkit-transform and should be included as well.", result.messages[0].message);
|
38
|
+
Assert.areEqual("warning", result.messages[1].type);
|
39
|
+
Assert.areEqual("The property -ms-transform is compatible with -webkit-transform and should be included as well.", result.messages[1].message);
|
40
|
+
Assert.areEqual("warning", result.messages[2].type);
|
41
|
+
Assert.areEqual("The property -o-transform is compatible with -webkit-transform and should be included as well.", result.messages[2].message);
|
42
|
+
},
|
43
|
+
|
44
|
+
"Using all compatible vendor prefixes for animation should be allowed with no warnings.": function(){
|
45
|
+
var result = CSSLint.verify(".next:focus { -moz-animation: 'diagonal-slide' 5s 10; -webkit-animation: 'diagonal-slide' 5s 10; -ms-animation: 'diagonal-slide' 5s 10; }", { "compatible-vendor-prefixes": 0 });
|
46
|
+
Assert.areEqual(0, result.messages.length);
|
47
|
+
},
|
48
|
+
|
49
|
+
"Using box-shadow with no vendor prefixes should be allowed with no warnings.": function(){
|
50
|
+
var result = CSSLint.verify("h1 { box-shadow: 5px 5px 5px #ccc; }", { "compatible-vendor-prefixes": 0 });
|
51
|
+
Assert.areEqual(0, result.messages.length);
|
52
|
+
}
|
53
|
+
|
54
|
+
}));
|
55
|
+
|
56
|
+
})();
|
@@ -0,0 +1,213 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
/*global YUITest, CSSLint*/
|
4
|
+
var Assert = YUITest.Assert;
|
5
|
+
|
6
|
+
YUITest.TestRunner.add(new YUITest.TestCase({
|
7
|
+
|
8
|
+
name: "Display Property Grouping Rule Errors",
|
9
|
+
|
10
|
+
/*
|
11
|
+
* - float should not be used with inline-block
|
12
|
+
* - height, width, margin-top, margin-bottom, float should not be used with inline
|
13
|
+
* - vertical-align should not be used with block
|
14
|
+
* - margin, float should not be used with table-*
|
15
|
+
*/
|
16
|
+
"Float with inline-block should result in a warning": function(){
|
17
|
+
var result = CSSLint.verify(".foo { float: left; display: inline-block; }", { "display-property-grouping": 1 });
|
18
|
+
Assert.areEqual(1, result.messages.length);
|
19
|
+
Assert.areEqual("warning", result.messages[0].type);
|
20
|
+
Assert.areEqual("float can't be used with display: inline-block.", result.messages[0].message);
|
21
|
+
},
|
22
|
+
|
23
|
+
"Float with inline should result in a warning": function(){
|
24
|
+
var result = CSSLint.verify(".foo { float: left; display: inline; }", { "display-property-grouping": 1 });
|
25
|
+
Assert.areEqual(1, result.messages.length);
|
26
|
+
Assert.areEqual("warning", result.messages[0].type);
|
27
|
+
Assert.areEqual("display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).", result.messages[0].message);
|
28
|
+
},
|
29
|
+
|
30
|
+
"Float:none with inline-block should not result in a warning": function(){
|
31
|
+
var result = CSSLint.verify(".foo { float: none; display: inline-block; }", { "display-property-grouping": 1 });
|
32
|
+
Assert.areEqual(0, result.messages.length);
|
33
|
+
},
|
34
|
+
|
35
|
+
"Float:none with inline should result not in a warning": function(){
|
36
|
+
var result = CSSLint.verify(".foo { float: none; display: inline; }", { "display-property-grouping": 1 });
|
37
|
+
Assert.areEqual(0, result.messages.length);
|
38
|
+
},
|
39
|
+
|
40
|
+
"Height with inline should result in a warning": function(){
|
41
|
+
var result = CSSLint.verify(".foo { height: 100px; display: inline; }", { "display-property-grouping": 1 });
|
42
|
+
Assert.areEqual(1, result.messages.length);
|
43
|
+
Assert.areEqual("warning", result.messages[0].type);
|
44
|
+
Assert.areEqual("height can't be used with display: inline.", result.messages[0].message);
|
45
|
+
},
|
46
|
+
|
47
|
+
"Width with inline should result in a warning": function(){
|
48
|
+
var result = CSSLint.verify(".foo { width: 100px; display: inline; }", { "display-property-grouping": 1 });
|
49
|
+
Assert.areEqual(1, result.messages.length);
|
50
|
+
Assert.areEqual("warning", result.messages[0].type);
|
51
|
+
Assert.areEqual("width can't be used with display: inline.", result.messages[0].message);
|
52
|
+
},
|
53
|
+
|
54
|
+
"Margin with inline should result in a warning": function(){
|
55
|
+
var result = CSSLint.verify(".foo { margin: 100px; display: inline; }", { "display-property-grouping": 1 });
|
56
|
+
Assert.areEqual(1, result.messages.length);
|
57
|
+
Assert.areEqual("warning", result.messages[0].type);
|
58
|
+
Assert.areEqual("margin can't be used with display: inline.", result.messages[0].message);
|
59
|
+
},
|
60
|
+
|
61
|
+
"Margin-left with inline should not result in a warning": function(){
|
62
|
+
var result = CSSLint.verify(".foo { margin-left: 100px; display: inline; }", { "display-property-grouping": 1 });
|
63
|
+
Assert.areEqual(0, result.messages.length);
|
64
|
+
},
|
65
|
+
|
66
|
+
"Margin-right with inline should not result in a warning": function(){
|
67
|
+
var result = CSSLint.verify(".foo { margin-right: 100px; display: inline; }", { "display-property-grouping": 1 });
|
68
|
+
Assert.areEqual(0, result.messages.length);
|
69
|
+
},
|
70
|
+
|
71
|
+
"Margin-top with inline should result in a warning": function(){
|
72
|
+
var result = CSSLint.verify(".foo { margin-top: 100px; display: inline; }", { "display-property-grouping": 1 });
|
73
|
+
Assert.areEqual(1, result.messages.length);
|
74
|
+
Assert.areEqual("warning", result.messages[0].type);
|
75
|
+
Assert.areEqual("margin-top can't be used with display: inline.", result.messages[0].message);
|
76
|
+
},
|
77
|
+
|
78
|
+
"Margin-bottom with inline should result in a warning": function(){
|
79
|
+
var result = CSSLint.verify(".foo { margin-bottom: 100px; display: inline; }", { "display-property-grouping": 1 });
|
80
|
+
Assert.areEqual(1, result.messages.length);
|
81
|
+
Assert.areEqual("warning", result.messages[0].type);
|
82
|
+
Assert.areEqual("margin-bottom can't be used with display: inline.", result.messages[0].message);
|
83
|
+
},
|
84
|
+
|
85
|
+
"Padding with inline should not result in a warning": function(){
|
86
|
+
var result = CSSLint.verify(".foo { padding: 100px; display: inline; }", { "display-property-grouping": 1 });
|
87
|
+
Assert.areEqual(0, result.messages.length);
|
88
|
+
},
|
89
|
+
|
90
|
+
"Padding-left with inline should not result in a warning": function(){
|
91
|
+
var result = CSSLint.verify(".foo { padding-left: 100px; display: inline; }", { "display-property-grouping": 1 });
|
92
|
+
Assert.areEqual(0, result.messages.length);
|
93
|
+
},
|
94
|
+
|
95
|
+
"Padding-right with inline should not result in a warning": function(){
|
96
|
+
var result = CSSLint.verify(".foo { padding-right: 100px; display: inline; }", { "display-property-grouping": 1 });
|
97
|
+
Assert.areEqual(0, result.messages.length);
|
98
|
+
},
|
99
|
+
|
100
|
+
"Padding-top with inline should not result in a warning": function(){
|
101
|
+
var result = CSSLint.verify(".foo { padding-top: 100px; display: inline; }", { "display-property-grouping": 1 });
|
102
|
+
Assert.areEqual(0, result.messages.length);
|
103
|
+
},
|
104
|
+
|
105
|
+
"Padding-bottom with inline should result in a warning": function(){
|
106
|
+
var result = CSSLint.verify(".foo { padding-bottom: 100px; display: inline; }", { "display-property-grouping": 1 });
|
107
|
+
Assert.areEqual(0, result.messages.length);
|
108
|
+
},
|
109
|
+
|
110
|
+
"Vertical-align with block should result in a warning": function(){
|
111
|
+
var result = CSSLint.verify(".foo { vertical-align: bottom; display: block; }", { "display-property-grouping": 1 });
|
112
|
+
Assert.areEqual(1, result.messages.length);
|
113
|
+
Assert.areEqual("warning", result.messages[0].type);
|
114
|
+
Assert.areEqual("vertical-align can't be used with display: block.", result.messages[0].message);
|
115
|
+
},
|
116
|
+
|
117
|
+
"Margin with table-cell should result in a warning": function(){
|
118
|
+
var result = CSSLint.verify(".foo { margin: 100px; display: table-cell; }", { "display-property-grouping": 1 });
|
119
|
+
Assert.areEqual(1, result.messages.length);
|
120
|
+
Assert.areEqual("warning", result.messages[0].type);
|
121
|
+
Assert.areEqual("margin can't be used with display: table-cell.", result.messages[0].message);
|
122
|
+
},
|
123
|
+
|
124
|
+
"Margin-left with table-cell should result in a warning": function(){
|
125
|
+
var result = CSSLint.verify(".foo { margin-left: 100px; display: table-cell; }", { "display-property-grouping": 1 });
|
126
|
+
Assert.areEqual(1, result.messages.length);
|
127
|
+
Assert.areEqual("warning", result.messages[0].type);
|
128
|
+
Assert.areEqual("margin-left can't be used with display: table-cell.", result.messages[0].message);
|
129
|
+
},
|
130
|
+
|
131
|
+
"Margin-right with table-cell should result in a warning": function(){
|
132
|
+
var result = CSSLint.verify(".foo { margin-right: 100px; display: table-cell; }", { "display-property-grouping": 1 });
|
133
|
+
Assert.areEqual(1, result.messages.length);
|
134
|
+
Assert.areEqual("warning", result.messages[0].type);
|
135
|
+
Assert.areEqual("margin-right can't be used with display: table-cell.", result.messages[0].message);
|
136
|
+
},
|
137
|
+
|
138
|
+
"Margin-top with table-cell should result in a warning": function(){
|
139
|
+
var result = CSSLint.verify(".foo { margin-top: 100px; display: table-cell; }", { "display-property-grouping": 1 });
|
140
|
+
Assert.areEqual(1, result.messages.length);
|
141
|
+
Assert.areEqual("warning", result.messages[0].type);
|
142
|
+
Assert.areEqual("margin-top can't be used with display: table-cell.", result.messages[0].message);
|
143
|
+
},
|
144
|
+
|
145
|
+
"Margin-bottom with table-cell should result in a warning": function(){
|
146
|
+
var result = CSSLint.verify(".foo { margin-bottom: 100px; display: table-cell; }", { "display-property-grouping": 1 });
|
147
|
+
Assert.areEqual(1, result.messages.length);
|
148
|
+
Assert.areEqual("warning", result.messages[0].type);
|
149
|
+
Assert.areEqual("margin-bottom can't be used with display: table-cell.", result.messages[0].message);
|
150
|
+
},
|
151
|
+
|
152
|
+
"Margin with table-row should result in a warning": function(){
|
153
|
+
var result = CSSLint.verify(".foo { margin: 100px; display: table-row; }", { "display-property-grouping": 1 });
|
154
|
+
Assert.areEqual(1, result.messages.length);
|
155
|
+
Assert.areEqual("warning", result.messages[0].type);
|
156
|
+
Assert.areEqual("margin can't be used with display: table-row.", result.messages[0].message);
|
157
|
+
},
|
158
|
+
|
159
|
+
"Margin-left with table-row should result in a warning": function(){
|
160
|
+
var result = CSSLint.verify(".foo { margin-left: 100px; display: table-row; }", { "display-property-grouping": 1 });
|
161
|
+
Assert.areEqual(1, result.messages.length);
|
162
|
+
Assert.areEqual("warning", result.messages[0].type);
|
163
|
+
Assert.areEqual("margin-left can't be used with display: table-row.", result.messages[0].message);
|
164
|
+
},
|
165
|
+
|
166
|
+
"Margin-right with table-row should result in a warning": function(){
|
167
|
+
var result = CSSLint.verify(".foo { margin-right: 100px; display: table-row; }", { "display-property-grouping": 1 });
|
168
|
+
Assert.areEqual(1, result.messages.length);
|
169
|
+
Assert.areEqual("warning", result.messages[0].type);
|
170
|
+
Assert.areEqual("margin-right can't be used with display: table-row.", result.messages[0].message);
|
171
|
+
},
|
172
|
+
|
173
|
+
"Margin-top with table-row should result in a warning": function(){
|
174
|
+
var result = CSSLint.verify(".foo { margin-top: 100px; display: table-row; }", { "display-property-grouping": 1 });
|
175
|
+
Assert.areEqual(1, result.messages.length);
|
176
|
+
Assert.areEqual("warning", result.messages[0].type);
|
177
|
+
Assert.areEqual("margin-top can't be used with display: table-row.", result.messages[0].message);
|
178
|
+
},
|
179
|
+
|
180
|
+
"Margin-bottom with table-row should result in a warning": function(){
|
181
|
+
var result = CSSLint.verify(".foo { margin-bottom: 100px; display: table-row; }", { "display-property-grouping": 1 });
|
182
|
+
Assert.areEqual(1, result.messages.length);
|
183
|
+
Assert.areEqual("warning", result.messages[0].type);
|
184
|
+
Assert.areEqual("margin-bottom can't be used with display: table-row.", result.messages[0].message);
|
185
|
+
},
|
186
|
+
|
187
|
+
"Float with table-row should result in a warning": function(){
|
188
|
+
var result = CSSLint.verify(".foo { float: left; display: table-row; }", { "display-property-grouping": 1 });
|
189
|
+
Assert.areEqual(1, result.messages.length);
|
190
|
+
Assert.areEqual("warning", result.messages[0].type);
|
191
|
+
Assert.areEqual("float can't be used with display: table-row.", result.messages[0].message);
|
192
|
+
},
|
193
|
+
|
194
|
+
"Float with table-cell should result in a warning": function(){
|
195
|
+
var result = CSSLint.verify(".foo { float: left; display: table-cell; }", { "display-property-grouping": 1 });
|
196
|
+
Assert.areEqual(1, result.messages.length);
|
197
|
+
Assert.areEqual("warning", result.messages[0].type);
|
198
|
+
Assert.areEqual("float can't be used with display: table-cell.", result.messages[0].message);
|
199
|
+
},
|
200
|
+
|
201
|
+
"Float:none with table-row should not result in a warning": function(){
|
202
|
+
var result = CSSLint.verify(".foo { float: none; display: table-row; }", { "display-property-grouping": 1 });
|
203
|
+
Assert.areEqual(0, result.messages.length);
|
204
|
+
},
|
205
|
+
|
206
|
+
"Float:none with table-cell should not result in a warning": function(){
|
207
|
+
var result = CSSLint.verify(".foo { float: none; display: table-cell; }", { "display-property-grouping": 1 });
|
208
|
+
Assert.areEqual(0, result.messages.length);
|
209
|
+
}
|
210
|
+
|
211
|
+
}));
|
212
|
+
|
213
|
+
})();
|