]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/tests/i18n/currency.html
Comment class stub
[eow] / static / dojo-release-1.1.1 / dijit / tests / i18n / currency.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2         "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4         <head>
5                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6                 <title>Test CurrencyTextBox</title>
7
8                 <script type="text/javascript" src="../../../dojo/dojo.js"
9                         djConfig="isDebug: true, extraLocale: ['zh-cn','fr-fr','ja-jp']"></script>
10                 <script type="text/javascript" src="../../../dojo/currency.js"></script>
11                 <script type="text/javascript" src="../../../dojo/number.js"></script>
12                 <script type="text/javascript">
13                         dojo.require("dijit.form.NumberTextBox");
14                         dojo.require("dijit.form.CurrencyTextBox");
15                         dojo.require("dijit.form.DateTextBox");
16                         dojo.require("dijit.form.ValidationTextBox");
17                         dojo.require("dojo.date.locale");
18                         dojo.require("dojo.date.stamp");
19                         dojo.require("dojo.parser");    // scan page for widgets and instantiate them
20                         dojo.require("doh.runner");
21                 </script>
22                 <script src="test_i18n.js"></script>
23                 <script type="text/javascript">
24                         dojo.addOnLoad(function(){
25                                 doh.register("t", getAllTestCases());
26                                 doh.run();
27                         });
28                 </script>
29
30                 <style type="text/css">
31                         @import "../../../dojo/resources/dojo.css";
32                         @import "../../themes/tundra/tundra.css";
33                         @import "../css/dijitTests.css";
34
35                         .title {
36                                 background-color:#ddd;
37                         }
38
39                         .hint {
40                                 background-color:#eee;
41                         }
42
43                         .testExample {
44                                 background-color:#fbfbfb;
45                                 padding:1em;
46                                 margin-bottom:1em;
47                                 border:1px solid #bfbfbf;
48                         }
49
50                         .dojoTitlePaneLabel label {
51                                 font-weight:bold;
52                         }
53
54                         td {white-space:nowrap}
55                 </style>
56         </head>
57
58         <body class="tundra">
59                 <h1 class="testTitle">Dijit TextBox Globalization Test for Currency</h1>
60
61 <!--            <h2 class="testTitle">Press the following button to start all test after this page is loaded.</h2>
62                 <button id="startButton" onclick="startTest()">Start Test</button> -->
63                 <p>
64                         Before start this test, make sure the <b>dojo/cldr/nls</b> contains the data for "zh-cn", "fr-fr", and "ja-jp"
65                         and currencies CNY, EGP, EUR, JPY. If not, convert these CLDR data and put them there.
66                 </p>
67
68                 <script>
69                 (function() {
70                         genFormatTestCases("Currency Format", "dijit.form.CurrencyTextBox", [
71
72                                 { attrs: {Currency: "CNY", lang: "zh-cn"},
73                                   desc: "Locale: <b>zh_CN</b> Currency: <b>CNY</b>",
74                                   value: "123456789.46",
75                                   expValue: "&#xFFE5;123,456,789.46",
76                                   comment: ""
77                                 },
78                                 { attrs: {Currency: "CNY", lang: "zh-cn"},
79                                   desc: "Locale: <b>zh_CN</b> Currency: <b>CNY</b>",
80                                   value: "-123456789.46",
81                                   expValue: "-&#xFFE5;123,456,789.46",
82                                   comment: ""
83                                 },
84
85                                 { attrs: {Currency: "EUR", lang: "fr-fr"},
86                                   desc: "Locale: <b>fr_FR</b> Currency: <b>EUR</b>",
87                                   value: "123456789.46",
88                                   expValue: "123&nbsp;456&nbsp;789,46 &euro;",
89                                   comment: ""
90                                 },
91                                 { attrs: {Currency: "EUR", lang: "fr-fr"},
92                                   desc: "Locale: <b>zh_CN</b> Currency: <b>EUR</b>",
93                                   value: "-123456789.46",
94                                   expValue: "-123&nbsp;456&nbsp;789,46 &euro;",
95                                   comment: ""
96                                 },
97
98                                 { attrs: {Currency: "JPY", lang: "ja-jp"},
99                                   desc: "Locale: <b>ja_JP</b> Currency: <b>JPY</b>",
100                                   value: "123456789.46",
101                                   expValue: "&#xFFE5;123,456,789",
102                                   comment: ""
103                                 },
104                                 { attrs: {Currency: "JPY", lang: "ja-jp"},
105                                   desc: "Locale: <b>ja_JP</b> Currency: <b>JPY</b>",
106                                   value: "-123456789.46",
107                                   expValue: "-&#xFFE5;123,456,789",
108                                   comment: ""
109                                 }
110                         ]);
111
112                         genValidateTestCases("Currency Validate", "dijit.form.CurrencyTextBox", [
113
114                                 { attrs: {Currency: "CNY", lang: "zh-cn"},
115                                   desc: "Locale: <b>zh_CN</b> Currency: <b>CNY</b>",
116                                   value: 123456789.46,
117                                   expValue: "&#xFFE5;123,456,789.46",
118                                   comment: ""
119                                 },
120                                 { attrs: {Currency: "CNY", lang: "zh-cn"},
121                                   desc: "Locale: <b>zh_CN</b> Currency: <b>CNY</b>",
122                                   value: -123456789.46,
123                                   expValue: "-&#xFFE5;123,456,789.46",
124                                   comment: ""
125                                 },
126
127                                 { attrs: {Currency: "EUR", lang: "fr-fr"},
128                                   desc: "Locale: <b>fr_FR</b> Currency: <b>EUR</b>",
129                                   value: 123456789.46,
130                                   expValue: "123&nbsp;456&nbsp;789,46 &euro;",
131                                   comment: ""
132                                 },
133                                 { attrs: {Currency: "EUR", lang: "fr-fr"},
134                                   desc: "Locale: <b>zh_CN</b> Currency: <b>EUR</b>",
135                                   value: -123456789.46,
136                                   expValue: "-123&nbsp;456&nbsp;789,46 &euro;",
137                                   comment: ""
138                                 },
139
140                                 { attrs: {Currency: "JPY", lang: "ja-jp"},
141                                   desc: "Locale: <b>ja_JP</b> Currency: <b>JPY</b>",
142                                   value: 123456789,
143                                   expValue: "&#xFFE5;123,456,789",
144                                   comment: ""
145                                 },
146                                 { attrs: {Currency: "JPY", lang: "ja-jp"},
147                                   desc: "Locale: <b>ja_JP</b> Currency: <b>JPY</b>",
148                                   value: -123456789,
149                                   expValue: "-&#xFFE5;123,456,789",
150                                   comment: ""
151                                 }
152                         ]);
153
154                         dojo.parser.parse();
155
156                 })();
157
158                 </script>
159
160                 <h2 class="testTitle">Issues &amp; Comments</h2>
161                 <h3 class="testTitle"><a name="cmt_1">Issue #1<sup style="color:blue">Fixed</sup></a></h3>
162                 <p>
163                         Some browsers like FireFox have a bug on the non-breaking space character (U+00A0, <b>&amp;nbsp;</b> or <b>&amp;#160;</b> or
164                         <b>&amp;#xA0;</b> in HTML).
165                         They always convert the NBSP character to a normal space (U+0020, <b>&amp;#x20;</b> in HTML) automatically in the following circumstances:
166         </p>
167                 <ul>
168                         <li>Copy text from the page</li>
169                         <li>Use <b>innerHTML</b> to get the content of a certain element</li>
170                         <li>Use <b>value</b> to get an <b>INPUT</b> element's value</li>
171                 </ul>
172                 
173                 <p>
174                         You cannot read a real NBSP character from an <b>INPUT</b> element on these browsers. It causes issues when some formatting data in CLDR
175                         contains an NBSP character. For example,
176                 </p>
177                 <ul>
178                         <li>Many locales like French use an NBSP character as a group separator in numbers</li>
179                         <li>French and Finnish use NBSP characters in their percentage and currency format patterns respectively</li>
180                 </ul>
181                 
182                 <p>
183                         So Dojo may generate formatted data with NBSP characters in it but cannot read NBSP charaters from user's input in some browser.
184                 </p>
185
186                 <h3 class="testTitle"><a name="cmt_2">Issue #2<sup style="color:blue">Fixed: the CLDR data generator should be fixed by adding code to convert U+200F to "\u200F" in nls JS files.</sup></a></h3>
187                 <p>
188                         Most Bidi currency symbols contain an LTR-MARK (U+200F) character at the very beginning.
189                         But Firefox ignores it when it is not in any escaping form. This should be a bug of Firefox.
190                         For example, click <a href="javascript:alert('‏'.indexOf('\u200F'))"><code>alert('‏'.indexOf('\u+200F'))</code></a> (there is a U+200F in the empty-looking string):
191                 </p>    
192                 <ul>
193                         <li>In Firefox, shows "-1" -- no U+200F found</li>
194                         <li>In IE &amp; Opera, shows "0" -- the U+200F is found</li>
195                 </ul>
196                 <p>
197                         But if the U+200F is in some escaping form, Firefox will work as well as other browsers.
198                         Click <a href="javascript:alert('\u200F'.indexOf('\u200F'))"><code>alert('\u200F'.indexOf('\u+200F'))</code></a> to see the same result both in Firefox and IE:
199                 </p>
200                 
201
202                 <h3 class="testTitle"><a name="cmt_3">Issue #3<sup style="color:blue">Fixed: added a "localeDigit" to the options</sup></a></h3>
203                 <p>
204                         Strictly speaking, the data conversion must support non-European number characters in some locales like Arabic and Hindi.
205                         For example, ICU formats a number data into Indic number characters by default in the Arabic locale.
206                         However, currently Dojo does not support this feature (Dojo uses the default number conversion of the browser).
207                 </p>
208
209         </body>
210 </html>