Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / chrome / test / data / webui / i18n_process_test.html
blob8072639a83fa1f3fd79b5d9e147f55b9a4904acc
1 <!doctype html>
2 <html>
3 <head>
4 <title i18n-content="title"></title>
5 <link rel="import" href="data:text/html,
6 <link rel=import href='data:text/html,<div i18n-content=nested>'>">
7 <script>
8 document.write('<link id=cycle rel=import href="' + location.href + '">');
9 </script>
10 </head>
11 <body i18n-values="type:type">
12 <span i18n-values=".innerHTML:content;.style.display:display">&lt;3</span>
13 <template>
14 <template>
15 <div i18n-content="nested"></div>
16 </template>
17 </template>
18 <script>
19 function setUpPage() {
20 loadTimeData.data = {
21 'content': "doesn't matter; you can't see me!",
22 'display': 'none',
23 'title': 'BUY NOW!',
24 'type': 'ectomorph',
25 'nested': 'real deep',
27 i18nTemplate.process(document, loadTimeData);
30 function testI18nProcess_Attributes() {
31 assertNotEqual('', document.title);
32 assertTrue(document.body.hasAttribute('type'));
33 assertTrue(document.querySelector('span').textContent.length > 5);
34 assertEquals('none', document.querySelector('span').style.display);
37 function testI18nProcess_Cycles() {
38 assertEquals(document.URL, $('cycle').import.URL);
41 function testI18nProcess_DocumentFragment() {
42 var span = document.createElement('span');
43 span.setAttribute('i18n-content', 'content');
45 var docFrag = document.createDocumentFragment();
46 docFrag.appendChild(span);
48 var div = document.createElement('div');
49 docFrag.appendChild(div);
51 i18nTemplate.process(docFrag, loadTimeData);
53 assertTrue(span.hasAttribute('i18n-processed'));
54 assertNotEqual('', span.textContent);
56 assertTrue(div.hasAttribute('i18n-processed'));
59 function testI18nProcess_Imports() {
60 var outerImportDoc = document.querySelector('link').import;
61 var innerImportDoc = outerImportDoc.querySelector('link').import;
62 assertNotEqual('', innerImportDoc.querySelector('div').textContent);
65 function testI18nProcess_ReRun() {
66 document.body.removeAttribute('type');
67 i18nTemplate.process(document, loadTimeData);
68 assertTrue(document.body.hasAttribute('type'));
71 function testI18nProcess_ShadowRoot() {
72 var a = document.createElement('a');
73 var outerShadow = a.createShadowRoot();
75 var b = document.createElement('b');
76 outerShadow.appendChild(b);
78 var innerShadow = b.createShadowRoot();
79 var i = document.createElement('i');
80 i.setAttribute('i18n-content', 'content');
81 innerShadow.appendChild(i);
83 i18nTemplate.process(i, loadTimeData);
85 assertTrue(i.hasAttribute('i18n-processed'));
86 assertNotEqual('', i.textContent);
89 function testI18nProcess_Templates() {
90 var outerDocFrag = document.querySelector('template').content;
91 var innerDocFrag = outerDocFrag.querySelector('template').content;
92 assertNotEqual('', innerDocFrag.querySelector('div').textContent);
94 </script>
95 </body>
96 </html>