1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>Test Hindi/Arabic numerals</title>
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");
22 <script src="test_i18n.js"></script>
23 <script type="text/javascript">
24 dojo.addOnLoad(function(){
25 doh.register("t", getAllTestCases());
31 function gen4DateFormat(testCases, language, locale, date, short, shortCmt, medium, mediumCmt, long, longCmt, full, fullCmt) {
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>",
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>",
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>",
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>",
62 <style type="text/css">
63 @import "../../../dojo/resources/dojo.css";
64 @import "../../themes/tundra/tundra.css";
65 @import "../css/dijitTests.css";
68 background-color:#ddd;
72 background-color:#eee;
76 background-color:#fbfbfb;
79 border:1px solid #bfbfbf;
82 .dojoTitlePaneLabel label {
86 td {white-space:nowrap}
91 <h1 class="testTitle">Dijit TextBox Globalization Test for Number</h1>
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>-->
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.
102 genFormatTestCases("Number Format", "dijit.form.NumberTextBox", [
103 { attrs: {lang: "ar-eg"},
104 desc: "Locale: ar_EG",
106 expValue: "12٬345٫067",
109 { attrs: {lang: "ar-eg"},
110 desc: "Locale: ar_EG",
112 expValue: "12٬345٫067-",
116 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
117 desc: "Locale: ar_EG",
119 expValue: "١٢\u066C٣٤٥\u066B٠٦٧",
120 comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
122 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
123 desc: "Locale: ar_EG",
125 expValue: "١٢\u066C٣٤٥\u066B٠٦٧-",
126 comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
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>"
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>"
143 genValidateTestCases("Number Validate", "dijit.form.NumberTextBox", [
145 { attrs: {lang: "ar-eg"},
146 desc: "Locale: ar_EG",
148 expValue: "12٬345٫067",
151 { attrs: {lang: "ar-eg"},
152 desc: "Locale: ar_EG",
154 expValue: "12٬345٫067-",
158 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
159 desc: "Locale: ar_EG",
161 expValue: "١٢\u066C٣٤٥\u066B٠٦٧",
162 comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
164 { attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"},
165 desc: "Locale: ar_EG",
167 expValue: "١٢\u066C٣٤٥\u066B٠٦٧-",
168 comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>"
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>"
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>"
185 genFormatTestCases("Currency Format", "dijit.form.CurrencyTextBox", [
187 { attrs: {Currency: "EGP", lang: "ar-eg"},
188 desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
189 value: "123456789.46",
190 expValue: "ج.م.\u200F 123٬456٬789٫46",
193 { attrs: {Currency: "EGP", lang: "ar-eg"},
194 desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
195 value: "-123456789.46",
196 expValue: "ج.م.\u200F 123٬456٬789٫46-",
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: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦",
204 comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
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: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-",
210 comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
214 genValidateTestCases("Currency Validate", "dijit.form.CurrencyTextBox", [
216 { attrs: {Currency: "EGP", lang: "ar-eg"},
217 desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
219 expValue: "ج.م.\u200F 123٬456٬789٫46",
220 comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
222 { attrs: {Currency: "EGP", lang: "ar-eg"},
223 desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
224 value: -123456789.46,
225 expValue: "ج.م.\u200F 123٬456٬789٫46-",
226 comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
229 { attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"},
230 desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>",
232 expValue: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦",
233 comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
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: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-",
239 comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>"
244 gen4DateFormat(testCases, "ar-eg", "ar_EG", "2005-07-31",
245 "31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 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);
251 gen4DateFormat(testCases, "ar-eg", "ar_EG", new Date(2005, 6, 31),
252 "31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 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);
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>",
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>",
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>",
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>",