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

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

Issue 1233883005: Fix i18nTemplate.process() for DocumentFragments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stronger typing 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
« no previous file with comments | « no previous file | ui/webui/resources/css/i18n_process.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index bbd89177b1a6801f2e703d3c5a4401d652e1c941..8072639a83fa1f3fd79b5d9e147f55b9a4904acc 100644
--- a/chrome/test/data/webui/i18n_process_test.html
+++ b/chrome/test/data/webui/i18n_process_test.html
@@ -16,10 +16,6 @@
</template>
</template>
<script>
-function runI18nProcess() {
- i18nTemplate.process(document, loadTimeData);
-}
-
function setUpPage() {
loadTimeData.data = {
'content': "doesn't matter; you can't see me!",
@@ -28,7 +24,7 @@ function setUpPage() {
'type': 'ectomorph',
'nested': 'real deep',
};
- runI18nProcess();
+ i18nTemplate.process(document, loadTimeData);
}
function testI18nProcess_Attributes() {
@@ -42,6 +38,24 @@ function testI18nProcess_Cycles() {
assertEquals(document.URL, $('cycle').import.URL);
}
+function testI18nProcess_DocumentFragment() {
+ var span = document.createElement('span');
+ span.setAttribute('i18n-content', 'content');
+
+ var docFrag = document.createDocumentFragment();
+ docFrag.appendChild(span);
+
+ var div = document.createElement('div');
+ docFrag.appendChild(div);
+
+ i18nTemplate.process(docFrag, loadTimeData);
+
+ assertTrue(span.hasAttribute('i18n-processed'));
+ assertNotEqual('', span.textContent);
+
+ assertTrue(div.hasAttribute('i18n-processed'));
+}
+
function testI18nProcess_Imports() {
var outerImportDoc = document.querySelector('link').import;
var innerImportDoc = outerImportDoc.querySelector('link').import;
@@ -50,10 +64,28 @@ function testI18nProcess_Imports() {
function testI18nProcess_ReRun() {
document.body.removeAttribute('type');
- runI18nProcess();
+ i18nTemplate.process(document, loadTimeData);
assertTrue(document.body.hasAttribute('type'));
}
+function testI18nProcess_ShadowRoot() {
+ var a = document.createElement('a');
+ var outerShadow = a.createShadowRoot();
+
+ var b = document.createElement('b');
+ outerShadow.appendChild(b);
+
+ var innerShadow = b.createShadowRoot();
+ var i = document.createElement('i');
+ i.setAttribute('i18n-content', 'content');
+ innerShadow.appendChild(i);
+
+ i18nTemplate.process(i, loadTimeData);
+
+ assertTrue(i.hasAttribute('i18n-processed'));
+ assertNotEqual('', i.textContent);
+}
+
function testI18nProcess_Templates() {
var outerDocFrag = document.querySelector('template').content;
var innerDocFrag = outerDocFrag.querySelector('template').content;
« no previous file with comments | « no previous file | ui/webui/resources/css/i18n_process.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698