OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import css_checker | 6 import css_checker |
7 from os import path as os_path | 7 from os import path as os_path |
8 import re | 8 import re |
9 from sys import path as sys_path | 9 from sys import path as sys_path |
10 import unittest | 10 import unittest |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 def testCssAlphaWithLongerDashedProps(self): | 133 def testCssAlphaWithLongerDashedProps(self): |
134 self.VerifyContentsProducesOutput(""" | 134 self.VerifyContentsProducesOutput(""" |
135 div { | 135 div { |
136 border-left: 5px; /* A hopefully removed comment. */ | 136 border-left: 5px; /* A hopefully removed comment. */ |
137 border: 5px solid red; | 137 border: 5px solid red; |
138 }""", """ | 138 }""", """ |
139 - Alphabetize properties and list vendor specific (i.e. -webkit) above standard. | 139 - Alphabetize properties and list vendor specific (i.e. -webkit) above standard. |
140 border-left: 5px; | 140 border-left: 5px; |
141 border: 5px solid red;""") | 141 border: 5px solid red;""") |
142 | 142 |
143 def testCssAlphaWithVariables(self): | |
144 self.VerifyContentIsValid(""" | |
145 #id { | |
146 --zzyxx-xylophone: 3px; | |
147 --aardvark-animal: var(--zzyxz-xylophone); | |
148 } | |
149 """) | |
150 | |
143 def testCssBracesHaveSpaceBeforeAndNothingAfter(self): | 151 def testCssBracesHaveSpaceBeforeAndNothingAfter(self): |
144 self.VerifyContentsProducesOutput(""" | 152 self.VerifyContentsProducesOutput(""" |
145 /* Hello! */div/* Comment here*/{ | 153 /* Hello! */div/* Comment here*/{ |
146 display: block; | 154 display: block; |
147 } | 155 } |
148 | 156 |
149 blah /* hey! */ | 157 blah /* hey! */ |
150 { | 158 { |
151 rule: value; | 159 rule: value; |
152 } | 160 } |
153 | 161 |
154 .mixed-in { | 162 .mixed-in { |
155 display: none; | 163 display: none; |
156 --css-mixin: { | 164 --css-mixin: { |
157 color: red; | 165 color: red; |
dschuyler
2016/09/19 21:23:28
Adding more elements to this test should
show the
Dan Beam
2016/09/22 02:13:26
Done.
| |
158 }; /* This should be ignored. */ | 166 }; /* This should be ignored. */ |
159 } | 167 } |
160 | 168 |
161 .this.is { /* allowed */ | 169 .this.is { /* allowed */ |
162 rule: value; | 170 rule: value; |
163 }""", """ | 171 }""", """ |
164 - Start braces ({) end a selector, have a space before them and no rules after. | 172 - Start braces ({) end a selector, have a space before them and no rules after. |
165 div{ | 173 div{ |
166 {""") | 174 {""") |
167 | 175 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 </style> | 486 </style> |
479 </head> | 487 </head> |
480 </html>""", """ | 488 </html>""", """ |
481 - Colons (:) should have a space after them. | 489 - Colons (:) should have a space after them. |
482 flex-direction:column; | 490 flex-direction:column; |
483 """, filename='test.html') | 491 """, filename='test.html') |
484 | 492 |
485 | 493 |
486 if __name__ == '__main__': | 494 if __name__ == '__main__': |
487 unittest.main() | 495 unittest.main() |
OLD | NEW |