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

Side by Side 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: videoplayer test fixes 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 unified diff | Download patch
OLDNEW
(Empty)
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 runI18nProcess() {
20 i18nTemplate.process(document, loadTimeData);
21 }
22
23 function setUpPage() {
24 loadTimeData.data = {
25 'content': "doesn't matter; you can't see me!",
26 'display': 'none',
27 'title': 'BUY NOW!',
28 'type': 'ectomorph',
29 'nested': 'real deep',
30 };
31 runI18nProcess();
32 }
33
34 function testI18nProcess_Attributes() {
35 assertNotEqual('', document.title);
36 assertTrue(document.body.hasAttribute('type'));
37 assertTrue(document.querySelector('span').textContent.length > 5);
38 assertEquals('none', document.querySelector('span').style.display);
39 }
40
41 function testI18nProcess_Cycles() {
42 assertEquals(document.URL, $('cycle').import.URL);
43 }
44
45 function testI18nProcess_Imports() {
46 var outerImportDoc = document.querySelector('link').import;
47 var innerImportDoc = outerImportDoc.querySelector('link').import;
48 assertNotEqual('', innerImportDoc.querySelector('div').textContent);
49 }
50
51 function testI18nProcess_ReRun() {
52 document.body.removeAttribute('type');
53 runI18nProcess();
54 assertTrue(document.body.hasAttribute('type'));
55 }
56
57 function testI18nProcess_Templates() {
58 var outerDocFrag = document.querySelector('template').content;
59 var innerDocFrag = outerDocFrag.querySelector('template').content;
60 assertNotEqual('', innerDocFrag.querySelector('div').textContent);
61 }
62 </script>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698