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

Unified Diff: tools/web_dev_style/js_checker_test.py

Issue 2907763004: js_checker.py: Replace custom GetElementByIdCheck with ESLint no-restricted-properties. (Closed)
Patch Set: Resolve conflicts. Created 3 years, 7 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
« no previous file with comments | « tools/web_dev_style/js_checker.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/web_dev_style/js_checker_test.py
diff --git a/tools/web_dev_style/js_checker_test.py b/tools/web_dev_style/js_checker_test.py
index 72f99545b69028d16aa81b4ef78c2501635e71c1..428c78248865c7f0fe37de8913721115fb3b28ce 100755
--- a/tools/web_dev_style/js_checker_test.py
+++ b/tools/web_dev_style/js_checker_test.py
@@ -203,49 +203,6 @@ class JsCheckerTest(SuperMoxTestBase):
for line in lines:
self.ShouldFailExtraDotInGenericCheck(line)
- def ShouldFailGetElementByIdCheck(self, line):
- """Checks that the 'getElementById' checker flags |line| as a style
- error.
- """
- error = self.checker.GetElementByIdCheck(1, line)
- self.assertNotEqual('', error,
- 'Should be flagged as style error: ' + line)
- self.assertEqual(test_util.GetHighlight(line, error),
- 'document.getElementById')
-
- def ShouldPassGetElementByIdCheck(self, line):
- """Checks that the 'getElementById' checker doesn't flag |line| as a style
- error.
- """
- self.assertEqual('', self.checker.GetElementByIdCheck(1, line),
- 'Should not be flagged as style error: ' + line)
-
- def testGetElementByIdFails(self):
- lines = [
- "document.getElementById('foo');",
- " document.getElementById('foo');",
- "var x = document.getElementById('foo');",
- "if (document.getElementById('foo').hidden) {",
- ]
- for line in lines:
- self.ShouldFailGetElementByIdCheck(line)
-
- def testGetElementByIdPasses(self):
- lines = [
- "elem.ownerDocument.getElementById('foo');",
- " elem.ownerDocument.getElementById('foo');",
- "var x = elem.ownerDocument.getElementById('foo');",
- "if (elem.ownerDocument.getElementById('foo').hidden) {",
- "doc.getElementById('foo');",
- " doc.getElementById('foo');",
- "cr.doc.getElementById('foo');",
- " cr.doc.getElementById('foo');",
- "var x = doc.getElementById('foo');",
- "if (doc.getElementById('foo').hidden) {",
- ]
- for line in lines:
- self.ShouldPassGetElementByIdCheck(line)
-
def ShouldFailInheritDocCheck(self, line):
"""Checks that the '@inheritDoc' checker flags |line| as a style error."""
error = self.checker.InheritDocCheck(1, line)
« no previous file with comments | « tools/web_dev_style/js_checker.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698