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

Side by Side Diff: chrome/test/data/webui/i18n_behavior_test.html

Issue 2886843005: [i18n] use Polymer data binding to change locale strings (Closed)
Patch Set: i18nDynamic test Created 3 years, 7 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
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script> 4 <script>
5 5
6 function setUpPage() { 6 function setUpPage() {
7 loadTimeData.data = { 7 loadTimeData.data = {
8 'allowedByDefault': '<a href="https://google.com">Google!</a>', 8 'allowedByDefault': '<a href="https://google.com">Google!</a>',
9 'customAttr': '<a is="action-link">Take action!</a>', 9 'customAttr': '<a is="action-link">Take action!</a>',
10 'customTag': "<x-foo>I'm an X, foo!</x-foo>", 10 'customTag': "<x-foo>I'm an X, foo!</x-foo>",
(...skipping 17 matching lines...) Expand all
28 I18nBehavior.i18nAdvanced('customAttr', { 28 I18nBehavior.i18nAdvanced('customAttr', {
29 attrs: { 29 attrs: {
30 is: function(el, val) { 30 is: function(el, val) {
31 return el.tagName == 'A' && val == 'action-link'; 31 return el.tagName == 'A' && val == 'action-link';
32 }, 32 },
33 }, 33 },
34 }); 34 });
35 I18nBehavior.i18nAdvanced('customTag', {tags: ['X-FOO']}); 35 I18nBehavior.i18nAdvanced('customTag', {tags: ['X-FOO']});
36 } 36 }
37 37
38 function testI18nDynamic() {
39 var locale = 'en';
40 assertEquals("I'm just text, nobody should have a problem with me!",
xiyuan 2017/05/31 15:38:41 nit: " -> ' ?
dschuyler 2017/05/31 18:23:16 I could go either way on this, but there does seem
xiyuan 2017/05/31 18:31:50 Both JS style guides (google or chromium) prefer '
41 I18nBehavior.i18nDynamic(locale, 'text'));
42 }
Dan Beam 2017/05/24 02:08:45 hmmmm, seems like we could make a more comprehensi
dschuyler 2017/05/31 18:23:16 I plan to follow up on this later (tests and the f
43
38 function testI18nExists() { 44 function testI18nExists() {
39 assertTrue(I18nBehavior.i18nExists('text')); 45 assertTrue(I18nBehavior.i18nExists('text'));
40 assertFalse(I18nBehavior.i18nExists('missingText')); 46 assertFalse(I18nBehavior.i18nExists('missingText'));
41 } 47 }
42 48
43 </script> 49 </script>
44 </body> 50 </body>
45 </html> 51 </html>
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe_welcome.js ('k') | ui/webui/resources/js/i18n_behavior.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698