Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title i18n-content="title"></title> | 4 <title i18n-content="title"></title> |
| 5 <link rel="import" href="data:text/html, | 5 <link rel="import" href="data:text/html, |
| 6 <link rel=import href='data:text/html,<div i18n-content=nested>'>"> | 6 <link rel=import href='data:text/html,<div i18n-content=nested>'>"> |
| 7 <script> | 7 <script> |
| 8 document.write('<link id=cycle rel=import href="' + location.href + '">'); | 8 document.write('<link id=cycle rel=import href="' + location.href + '">'); |
| 9 </script> | 9 </script> |
| 10 </head> | 10 </head> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 docFrag.appendChild(div); | 49 docFrag.appendChild(div); |
| 50 | 50 |
| 51 i18nTemplate.process(docFrag, loadTimeData); | 51 i18nTemplate.process(docFrag, loadTimeData); |
| 52 | 52 |
| 53 assertTrue(span.hasAttribute('i18n-processed')); | 53 assertTrue(span.hasAttribute('i18n-processed')); |
| 54 assertNotEqual('', span.textContent); | 54 assertNotEqual('', span.textContent); |
| 55 | 55 |
| 56 assertTrue(div.hasAttribute('i18n-processed')); | 56 assertTrue(div.hasAttribute('i18n-processed')); |
| 57 } | 57 } |
| 58 | 58 |
| 59 function testI18nProcess_Events() { | |
| 60 var called = false; | |
| 61 | |
| 62 document.addEventListener('i18n-processed', function(e) { | |
| 63 assertEquals(document, e.target); | |
| 64 called = true; | |
| 65 }); | |
| 66 | |
| 67 i18nTemplate.process(document, loadTimeData); | |
| 68 | |
| 69 assertTrue(called); | |
| 70 } | |
|
Dan Beam
2016/02/17 04:47:34
mocha-specific tests are here:
https://codereview.
| |
| 71 | |
| 59 function testI18nProcess_Imports() { | 72 function testI18nProcess_Imports() { |
| 60 var outerImportDoc = document.querySelector('link').import; | 73 var outerImportDoc = document.querySelector('link').import; |
| 61 var innerImportDoc = outerImportDoc.querySelector('link').import; | 74 var innerImportDoc = outerImportDoc.querySelector('link').import; |
| 62 assertNotEqual('', innerImportDoc.querySelector('div').textContent); | 75 assertNotEqual('', innerImportDoc.querySelector('div').textContent); |
| 63 } | 76 } |
| 64 | 77 |
| 65 function testI18nProcess_ReRun() { | 78 function testI18nProcess_ReRun() { |
| 66 document.body.removeAttribute('type'); | 79 document.body.removeAttribute('type'); |
| 67 i18nTemplate.process(document, loadTimeData); | 80 i18nTemplate.process(document, loadTimeData); |
| 68 assertTrue(document.body.hasAttribute('type')); | 81 assertTrue(document.body.hasAttribute('type')); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 87 } | 100 } |
| 88 | 101 |
| 89 function testI18nProcess_Templates() { | 102 function testI18nProcess_Templates() { |
| 90 var outerDocFrag = document.querySelector('template').content; | 103 var outerDocFrag = document.querySelector('template').content; |
| 91 var innerDocFrag = outerDocFrag.querySelector('template').content; | 104 var innerDocFrag = outerDocFrag.querySelector('template').content; |
| 92 assertNotEqual('', innerDocFrag.querySelector('div').textContent); | 105 assertNotEqual('', innerDocFrag.querySelector('div').textContent); |
| 93 } | 106 } |
| 94 </script> | 107 </script> |
| 95 </body> | 108 </body> |
| 96 </html> | 109 </html> |
| OLD | NEW |