]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/tests/i18n/digit.html
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dijit / tests / i18n / digit.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 Hindi/Arabic numerals</title>
7
8                 <script type="text/javascript" src="../../../dojo/dojo.js"
9                         djConfig="isDebug: true, extraLocale: ['ar-eg','hi-in']"></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                 <script>
31                         function gen4DateFormat(testCases, language, locale, date, short, shortCmt, medium, mediumCmt, long, longCmt, full, fullCmt) {
32                                 testCases.push({
33                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
34                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
35                                   value: date,
36                                   expValue: short,
37                                   comment: shortCmt
38                                 });
39                                 testCases.push({
40                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
41                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
42                                   value: date,
43                                   expValue: medium,
44                                   comment: mediumCmt
45                                 });
46                                 testCases.push({
47                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
48                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
49                                   value: date,
50                                   expValue: long,
51                                   comment: longCmt
52                                 });
53                                 testCases.push({
54                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
55                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
56                                   value: date,
57                                   expValue: full,
58                                   comment: fullCmt
59                                 });
60                         }
61                 </script>
62                 <style type="text/css">
63                         @import "../../../dojo/resources/dojo.css";
64                         @import "../../themes/tundra/tundra.css";
65                         @import "../css/dijitTests.css";
66
67                         .title {
68                                 background-color:#ddd;
69                         }
70
71                         .hint {
72                                 background-color:#eee;
73                         }
74
75                         .testExample {
76                                 background-color:#fbfbfb;
77                                 padding:1em;
78                                 margin-bottom:1em;
79                                 border:1px solid #bfbfbf;
80                         }
81
82                         .dojoTitlePaneLabel label {
83                                 font-weight:bold;
84                         }
85
86                         td {white-space:nowrap}
87                 </style>
88         </head>
89
90         <body class="tundra">
91                 <h1 class="testTitle">Dijit TextBox Globalization Test for Number</h1>
92
93 <!--            <h2 class="testTitle">Press the following button to start all test after this page is loaded.</h2>
94                 <button id="startButton" onclick="startTest()">Start Test</button>-->
95                 <p>
96                         Before start this test, make sure the <b>dojo/cldr/nls</b> contains the data for "ar-eg" and "hi-in". If not, convert these CLDR data and put them there.
97                 </p>
98
99                 <script>
100                 (function() {
101
102                         genFormatTestCases("Number Format", "dijit.form.NumberTextBox", [
103                                 { attrs: {lang: "ar-eg"},
104                                   desc: "Locale: ar_EG",
105                                   value: "12345.067",
106                                   expValue: "12٬345٫067",
107                                   comment: ""
108                                 },
109                                 { attrs: {lang: "ar-eg"},
110                                   desc: "Locale: ar_EG",
111                                   value: "-12345.067",
112                                   expValue: "12٬345٫067-",
113                                   comment: ""
114                                 },
115
116                                 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
117                                   desc: "Locale: ar_EG",
118                                   value: "12345.067",
119                                   expValue: "١٢\u066C٣٤٥\u066B٠٦٧",
120                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
121                                 },
122                                 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
123                                   desc: "Locale: ar_EG",
124                                   value: "-12345.067",
125                                   expValue: "١٢\u066C٣٤٥\u066B٠٦٧-",
126                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
127                                 },
128
129                                 { attrs: {lang: "hi-in", constraints: "{localeDigit: true}"},
130                                   desc: "Locale: hi_IN",
131                                   value: "123456789.068",
132                                   expValue: "१२,३४,५६,७८९.०६८",
133                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
134                                 },
135                                 { attrs: {lang: "hi-in", constraints: "{localeDigit: true}"},
136                                   desc: "Locale: hi_IN",
137                                   value: "-123456789.068",
138                                   expValue: "-१२,३४,५६,७८९.०६८",
139                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
140                                 }
141                         ]);
142
143                         genValidateTestCases("Number Validate", "dijit.form.NumberTextBox", [
144
145                                 { attrs: {lang: "ar-eg"},
146                                   desc: "Locale: ar_EG",
147                                   value: 12345.067,
148                                   expValue: "12٬345٫067",
149                                   comment: ""
150                                 },
151                                 { attrs: {lang: "ar-eg"},
152                                   desc: "Locale: ar_EG",
153                                   value: -12345.067,
154                                   expValue: "12٬345٫067-",
155                                   comment: ""
156                                 },
157
158                                 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
159                                   desc: "Locale: ar_EG",
160                                   value: 12345.067,
161                                   expValue: "١٢\u066C٣٤٥\u066B٠٦٧",
162                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
163                                 },
164                                 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
165                                   desc: "Locale: ar_EG",
166                                   value: -12345.067,
167                                   expValue: "١٢\u066C٣٤٥\u066B٠٦٧-",
168                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
169                                 },
170
171                                 { attrs: {lang: "hi-in", constraints: "{localeDigit: true}"},
172                                   desc: "Locale: hi_IN",
173                                   value: 123456789.068,
174                                   expValue: "१२,३४,५६,७८९.०६८",
175                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
176                                 },
177                                 { attrs: {lang: "hi-in", constraints: "{localeDigit: true}"},
178                                   desc: "Locale: hi_IN",
179                                   value: -123456789.068,
180                                   expValue: "-१२,३४,५६,७८९.०६८",
181                                   comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
182                                 }
183                         ]);
184
185                         genFormatTestCases("Currency Format", "dijit.form.CurrencyTextBox", [
186
187                                 { attrs: {Currency: "EGP", lang: "ar-eg"},
188                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
189                                   value: "123456789.46",
190                                   expValue: "&#x062C;.&#x0645;.\u200F 123&#x066C;456&#x066C;789&#x066B;46",
191                                   comment: ""
192                                 },
193                                 { attrs: {Currency: "EGP", lang: "ar-eg"},
194                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
195                                   value: "-123456789.46",
196                                   expValue: "&#x062C;.&#x0645;.\u200F 123&#x066C;456&#x066C;789&#x066B;46-",
197                                   comment: ""
198                                 },
199
200                                 { attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"},
201                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
202                                   value: "123456789.46",
203                                   expValue: "&#x062C;.&#x0645;.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦",
204                                   comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
205                                 },
206                                 { attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"},
207                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
208                                   value: "-123456789.46",
209                                   expValue: "&#x062C;.&#x0645;.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-",
210                                   comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
211                                 }
212                         ]);
213
214                         genValidateTestCases("Currency Validate", "dijit.form.CurrencyTextBox", [
215
216                                 { attrs: {Currency: "EGP", lang: "ar-eg"},
217                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
218                                   value: 123456789.46,
219                                   expValue: "&#x062C;.&#x0645;.\u200F 123&#x066C;456&#x066C;789&#x066B;46",
220                                   comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
221                                 },
222                                 { attrs: {Currency: "EGP", lang: "ar-eg"},
223                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
224                                   value: -123456789.46,
225                                   expValue: "&#x062C;.&#x0645;.\u200F 123&#x066C;456&#x066C;789&#x066B;46-",
226                                   comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
227                                 },
228
229                                 { attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"},
230                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
231                                   value: 123456789.46,
232                                   expValue: "&#x062C;.&#x0645;.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦",
233                                   comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
234                                 },
235                                 { attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"},
236                                   desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
237                                   value: -123456789.46,
238                                   expValue: "&#x062C;.&#x0645;.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-",
239                                   comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
240                                 }
241                         ]);
242
243                         var testCases = [];
244                         gen4DateFormat(testCases, "ar-eg", "ar_EG", "2005-07-31",
245                                 "31/7/2005", "", "31/07/2005", "", "31 &#x064A;&#x0648;&#x0644;&#x064A;&#x0648;&#x2C; 2005", "", "&#x0627;&#x0644;&#x0623;&#x062D;&#x062F;&#x2C; 31 &#x064A;&#x0648;&#x0644;&#x064A;&#x0648;&#x2C; 2005", "");
246                         gen4DateFormat(testCases, "hi-in", "hi_IN", "2005-07-31",
247                                 "२००५-०७-३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "२००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "२००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "रविवार, २००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>");
248                         genFormatTestCases("Date Format", "dijit.form.DateTextBox", testCases);
249
250                         testCases = [];
251                         gen4DateFormat(testCases, "ar-eg", "ar_EG", new Date(2005, 6, 31),
252                                 "31/7/2005", "", "31/07/2005", "", "31 &#x064A;&#x0648;&#x0644;&#x064A;&#x0648;&#x2C; 2005", "", "&#x0627;&#x0644;&#x0623;&#x062D;&#x062F;&#x2C; 31 &#x064A;&#x0648;&#x0644;&#x064A;&#x0648;&#x2C; 2005", "");
253                         gen4DateFormat(testCases, "hi-in", "hi_IN", new Date(2005, 6, 31),
254                                 "२००५-०७-३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "२००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "२००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>", "रविवार, २००५ जुलाई ३१", "<a href='currency.html#cmt_3'>See #3 (currency.html).</a>");
255                         genValidateTestCases("Date Validate", "dijit.form.DateTextBox", testCases);
256
257                         dojo.parser.parse();
258
259                 })();
260
261                 </script>
262         </body>
263 </html>
264
265 <!--
266                                 testCases.push({
267                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
268                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
269                                   value: date,
270                                   expValue: short,
271                                   comment: shortCmt
272                                 });
273                                 testCases.push({
274                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
275                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
276                                   value: date,
277                                   expValue: medium,
278                                   comment: mediumCmt
279                                 });
280                                 testCases.push({
281                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
282                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
283                                   value: date,
284                                   expValue: long,
285                                   comment: longCmt
286                                 });
287                                 testCases.push({
288                                   attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
289                                   desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
290                                   value: date,
291                                   expValue: full,
292                                   comment: fullCmt
293 -->
294