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

Unified Diff: chrome/test/data/webui/i18n_process_test.html

Issue 1229573003: Teach i18nTemplate.process() to handle <link rel=import> and <template> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +cycle test Created 5 years, 5 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/test/data/webui/i18n_process_test.html
diff --git a/chrome/test/data/webui/i18n_process_test.html b/chrome/test/data/webui/i18n_process_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..a649c192cd38912f1f9bcbe3cf24cd97814122ab
--- /dev/null
+++ b/chrome/test/data/webui/i18n_process_test.html
@@ -0,0 +1,54 @@
+<!doctype html>
+<html>
+ <head>
+ <title i18n-content="title"></title>
+ <link rel="import" href="data:text/html,
+ <link rel=import href='data:text/html,<div i18n-content=nested>'>">
+ <script>
+ document.write('<link id=cycle rel=import href="' + location.href + '">');
+ </script>
+ </head>
+ <body i18n-values="type:type">
+ <span i18n-values=".innerHTML:content;.style.display:display">&lt;3</span>
+ <template>
+ <template>
+ <div i18n-content="nested"></div>
+ </template>
+ </template>
+ <script>
+function setUpPage() {
+ loadTimeData.data = {
+ 'content': "doesn't matter; you can't see me!",
+ 'display': 'none',
+ 'title': 'BUY NOW!',
+ 'type': 'ectomorph',
+ 'nested': 'real deep',
+ };
+ i18nTemplate.process(document, loadTimeData);
+}
+
+function testI18nProcess_Attributes() {
+ assertNotEqual(0, document.title.length);
+ assertTrue(document.body.hasAttribute('type'));
+ assertTrue(document.querySelector('span').textContent.length > 5);
+ assertEquals('none', document.querySelector('span').style.display);
+}
+
+function testI18nProcess_Cycles() {
+ assertEquals(document.URL, $('cycle').import.URL);
+}
+
+function testI18nProcess_Imports() {
+ var outerImportDoc = document.querySelector('link').import;
+ var innerImportDoc = outerImportDoc.querySelector('link').import;
+ assertNotEqual(0, innerImportDoc.querySelector('div').textContent.length);
+}
+
+function testI18nProcess_Templates() {
+ var outerDocFrag = document.querySelector('template').content;
+ var innerDocFrag = outerDocFrag.querySelector('template').content;
+ assertNotEqual(0, innerDocFrag.querySelector('div').textContent.length);
+}
dzhioev (left Google) 2015/07/14 02:43:22 I believe we need tests for actual custom elements
Dan Beam 2015/07/14 16:28:20 I tried the typical <link rel=import> (which didn'
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698