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 html_checker | 6 import html_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 test_util | 10 import test_util |
(...skipping 29 matching lines...) Expand all Loading... | |
40 def testClassesUseDashFormCheckFails(self): | 40 def testClassesUseDashFormCheckFails(self): |
41 lines = [ | 41 lines = [ |
42 ' <a class="Foo-bar" href="classBar"> ', | 42 ' <a class="Foo-bar" href="classBar"> ', |
43 '<b class="foo-Bar"> ', | 43 '<b class="foo-Bar"> ', |
44 '<i class="foo_bar" >', | 44 '<i class="foo_bar" >', |
45 ' <hr class="fooBar"> ', | 45 ' <hr class="fooBar"> ', |
46 ] | 46 ] |
47 for line in lines: | 47 for line in lines: |
48 self.ShouldFailCheck(line, self.checker.ClassesUseDashFormCheck) | 48 self.ShouldFailCheck(line, self.checker.ClassesUseDashFormCheck) |
49 | 49 |
50 def testSingleQuoteCheckFails(self): | |
51 lines = [ | |
52 """ <a href='classBar'> """, | |
53 """<a foo="bar" href='classBar'>""", | |
54 """<a foo="bar" less="more" href='classBar' kittens="cats">""", | |
55 ] | |
56 for line in lines: | |
57 self.ShouldFailCheck(line, self.checker.DoNotUseSingleQuotesCheck) | |
Dan Beam
2016/06/23 19:28:03
please add things that should succeed like
<b id=
dschuyler
2016/06/23 20:44:37
Done.
| |
58 | |
50 def testClassesUseDashFormCheckPasses(self): | 59 def testClassesUseDashFormCheckPasses(self): |
51 lines = [ | 60 lines = [ |
52 ' class="abc" ', | 61 ' class="abc" ', |
53 'class="foo-bar"', | 62 'class="foo-bar"', |
54 '<div class="foo-bar" id="classBar"', | 63 '<div class="foo-bar" id="classBar"', |
55 ] | 64 ] |
56 for line in lines: | 65 for line in lines: |
57 self.ShouldPassCheck(line, self.checker.ClassesUseDashFormCheck) | 66 self.ShouldPassCheck(line, self.checker.ClassesUseDashFormCheck) |
58 | 67 |
59 def testDoNotCloseSingleTagsCheckFails(self): | 68 def testDoNotCloseSingleTagsCheckFails(self): |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 ' my-for="abc" ', | 170 ' my-for="abc" ', |
162 ' myfor="abc" ', | 171 ' myfor="abc" ', |
163 " <for", | 172 " <for", |
164 ] | 173 ] |
165 for line in lines: | 174 for line in lines: |
166 self.ShouldPassCheck(line, self.checker.LabelCheck) | 175 self.ShouldPassCheck(line, self.checker.LabelCheck) |
167 | 176 |
168 | 177 |
169 if __name__ == '__main__': | 178 if __name__ == '__main__': |
170 unittest.main() | 179 unittest.main() |
OLD | NEW |