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

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: +cycle test 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 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',
26 };
27 i18nTemplate.process(document, loadTimeData);
28 }
29
30 function testI18nProcess_Attributes() {
31 assertNotEqual(0, document.title.length);
32 assertTrue(document.body.hasAttribute('type'));
33 assertTrue(document.querySelector('span').textContent.length > 5);
34 assertEquals('none', document.querySelector('span').style.display);
35 }
36
37 function testI18nProcess_Cycles() {
38 assertEquals(document.URL, $('cycle').import.URL);
39 }
40
41 function testI18nProcess_Imports() {
42 var outerImportDoc = document.querySelector('link').import;
43 var innerImportDoc = outerImportDoc.querySelector('link').import;
44 assertNotEqual(0, innerImportDoc.querySelector('div').textContent.length);
45 }
46
47 function testI18nProcess_Templates() {
48 var outerDocFrag = document.querySelector('template').content;
49 var innerDocFrag = outerDocFrag.querySelector('template').content;
50 assertNotEqual(0, innerDocFrag.querySelector('div').textContent.length);
51 }
dzhioev (left Google) 2015/07/14 02:43:22 I believe we need tests for actual custom elements
Dan Beam 2015/07/14 16:28:20 I tried the typical <link rel=import> (which didn'
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698