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; |