OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Unit tests for Web Development Style Guide checker.""" | 6 """Unit tests for Web Development Style Guide checker.""" |
7 | 7 |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 a, | 443 a, |
444 div,a { | 444 div,a { |
445 some-other: rule here; | 445 some-other: rule here; |
446 }""", """ | 446 }""", """ |
447 - One selector per line (what not to do: a, b {}). | 447 - One selector per line (what not to do: a, b {}). |
448 div,a, | 448 div,a, |
449 div, span, | 449 div, span, |
450 div,a {""") | 450 div,a {""") |
451 | 451 |
| 452 def testCssPseudoElementDoubleColon(self): |
| 453 self.VerifyContentsProducesOutput(""" |
| 454 a:href, |
| 455 br::after, |
| 456 ::-webkit-scrollbar-thumb, |
| 457 a:not([empty]):hover:focus:active, /* shouldn't catch here and above */ |
| 458 abbr:after, |
| 459 .tree-label:empty:after, |
| 460 b:before, |
| 461 :-webkit-scrollbar { |
| 462 rule: value; |
| 463 }""", """ |
| 464 - Pseudo-elements should use double colon (i.e. ::after). |
| 465 :after (should be ::after) |
| 466 :after (should be ::after) |
| 467 :before (should be ::before) |
| 468 :-webkit-scrollbar (should be ::-webkit-scrollbar) |
| 469 """) |
| 470 |
452 def testCssRgbIfNotGray(self): | 471 def testCssRgbIfNotGray(self): |
453 self.VerifyContentsProducesOutput(""" | 472 self.VerifyContentsProducesOutput(""" |
454 #abc, | 473 #abc, |
455 #aaa, | 474 #aaa, |
456 #aabbcc { | 475 #aabbcc { |
457 background: -webkit-linear-gradient(left, from(#abc), to(#def)); | 476 background: -webkit-linear-gradient(left, from(#abc), to(#def)); |
458 color: #bad; | 477 color: #bad; |
459 color: #bada55; | 478 color: #bada55; |
460 }""", """ | 479 }""", """ |
461 - Use rgb() over #hex when not a shade of gray (like #333). | 480 - Use rgb() over #hex when not a shade of gray (like #333). |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 opacity: .0; | 535 opacity: .0; |
517 opacity: 0.0; | 536 opacity: 0.0; |
518 opacity: 0.; | 537 opacity: 0.; |
519 border-width: 0mm; | 538 border-width: 0mm; |
520 height: 0cm; | 539 height: 0cm; |
521 width: 0in; | 540 width: 0in; |
522 """) | 541 """) |
523 | 542 |
524 if __name__ == '__main__': | 543 if __name__ == '__main__': |
525 unittest.main() | 544 unittest.main() |
OLD | NEW |