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

Unified Diff: grit/format/html_inline_unittest.py

Issue 18568003: Fix LINK and INCLUDE HTML inlining Regexes to Support End Tags on Different Lines (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 7 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
« no previous file with comments | « grit/format/html_inline.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/html_inline_unittest.py
diff --git a/grit/format/html_inline_unittest.py b/grit/format/html_inline_unittest.py
index 45840f2e75ce234398a7dcbecf9307f4aeb7fde4..96d87502768736a98760d784da97fc7537fc6e47 100755
--- a/grit/format/html_inline_unittest.py
+++ b/grit/format/html_inline_unittest.py
@@ -262,6 +262,67 @@ class HtmlInlineUnittest(unittest.TestCase):
resources.add(tmp_dir.GetPath('index.html'))
self.failUnlessEqual(resources, source_resources)
+ def testWithCloseTags(self):
+ '''Tests that close tags are removed.'''
+
+ files = {
+ 'index.html': '''
+ <html>
+ <head>
+ <link rel="stylesheet" href="style1.css"></link>
+ <link rel="stylesheet" href="style2.css">
+ </link>
+ <link rel="stylesheet" href="style2.css"
+ >
+ </link>
+ <script src="script1.js"></script>
+ </head>
+ <include src="tmpl1.html"></include>
+ <include src="tmpl2.html">
+ </include>
+ <include src="tmpl2.html"
+ >
+ </include>
+ <img src="img1.png">
+ </html>
+ ''',
+ 'style1.css': '''h1 {}''',
+ 'style2.css': '''h2 {}''',
+ 'tmpl1.html': '''<h1></h1>''',
+ 'tmpl2.html': '''<h2></h2>''',
+ 'script1.js': '''console.log('hello');''',
+ 'img1.png': '''abc''',
+ }
+
+ expected_inlined = '''
+ <html>
+ <head>
+ <style>h1 {}</style>
+ <style>h2 {}</style>
+ <style>h2 {}</style>
+ <script>console.log('hello');</script>
+ </head>
+ <h1></h1>
+ <h2></h2>
+ <h2></h2>
+ <img src="data:image/png;base64,YWJj">
+ </html>
+ '''
+
+ source_resources = set()
+ tmp_dir = util.TempDir(files)
+ for filename in files:
+ source_resources.add(tmp_dir.GetPath(filename))
+
+ # Test normal inlining.
+ result = html_inline.DoInline(
+ tmp_dir.GetPath('index.html'),
+ None)
+ resources = result.inlined_files
+ resources.add(tmp_dir.GetPath('index.html'))
+ self.failUnlessEqual(resources, source_resources)
+ self.failUnlessEqual(expected_inlined,
+ util.FixLineEnd(result.inlined_data, '\n'))
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « grit/format/html_inline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698