Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1409)

Unified Diff: chrome/browser/web_dev_style/html_checker_test.py

Issue 2091903002: [Presubmit] check for single quotes in html properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: multi-line Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_dev_style/html_checker_test.py
diff --git a/chrome/browser/web_dev_style/html_checker_test.py b/chrome/browser/web_dev_style/html_checker_test.py
index e2472bbef03320ce306bb614c976aba61f61a235..08efc9ae46f2f72a97f8f95351ce4c3012ebba9c 100755
--- a/chrome/browser/web_dev_style/html_checker_test.py
+++ b/chrome/browser/web_dev_style/html_checker_test.py
@@ -56,6 +56,28 @@ class HtmlCheckerTest(SuperMoxTestBase):
for line in lines:
self.ShouldPassCheck(line, self.checker.ClassesUseDashFormCheck)
+ def testSingleQuoteCheckFails(self):
+ lines = [
+ """ <a href='classBar'> """,
+ """<a foo$="bar" href$='classBar'>""",
+ """<a foo="bar" less="more" href='classBar' kittens="cats">""",
+ """<a cats href='classBar' dogs>""",
+ """<a cats\n href='classBar'\n dogs>""",
Dan Beam 2016/06/25 00:49:03 """<a cats href='classBat\nclassBaz' dogs>"""
dschuyler 2016/06/28 19:04:18 Done.
+ ]
+ for line in lines:
+ self.ShouldFailCheck(line, self.checker.DoNotUseSingleQuotesCheck)
+
+ def testSingleQuoteCheckPasses(self):
+ lines = [
+ """<b id="super-valid">SO VALID!</b>""",
+ """<a text$="i ain't got invalid quotes">i don't</a>""",
+ """<span>[[i18n('blah')]]</span> """,
+ """<a cats href="classBar" dogs>""",
+ """<a cats\n href="classBar"\n dogs>""",
+ ]
+ for line in lines:
+ self.ShouldPassCheck(line, self.checker.DoNotUseSingleQuotesCheck)
+
def testDoNotCloseSingleTagsCheckFails(self):
lines = [
"<input/>",

Powered by Google App Engine
This is Rietveld 408576698