| 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 |
data-dojo-config="isDebug: true, extraLocale: ['ar-eg','hi-in']"></script> |
| 10 |
<script type="text/javascript"> |
| 11 |
dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 12 |
dojo.require("dijit.form.NumberTextBox"); |
| 13 |
dojo.require("dijit.form.CurrencyTextBox"); |
| 14 |
dojo.require("dijit.form.DateTextBox"); |
| 15 |
dojo.require("dijit.form.ValidationTextBox"); |
| 16 |
dojo.require("dojo.date.locale"); |
| 17 |
dojo.require("dojo.date.stamp"); |
| 18 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them |
| 19 |
dojo.require("doh.runner"); |
| 20 |
</script> |
| 21 |
<script src="test_i18n.js"></script> |
| 22 |
<script type="text/javascript"> |
| 23 |
dojo.ready(function(){ |
| 24 |
doh.register("parse", function(){ |
| 25 |
dojo.parser.parse(); |
| 26 |
}); |
| 27 |
doh.register("t", getAllTestCases()); |
| 28 |
doh.run(); |
| 29 |
}); |
| 30 |
</script> |
| 31 |
|
| 32 |
<script> |
| 33 |
function gen4DateFormat(testCases, language, locale, date, shortVal, shortCmt, mediumVal, mediumCmt, longVal, longCmt, fullVal, fullCmt){ |
| 34 |
testCases.push({ |
| 35 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language}, |
| 36 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>", |
| 37 |
value: date, |
| 38 |
expValue: shortVal, |
| 39 |
comment: shortCmt |
| 40 |
}); |
| 41 |
testCases.push({ |
| 42 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language}, |
| 43 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>", |
| 44 |
value: date, |
| 45 |
expValue: mediumVal, |
| 46 |
comment: mediumCmt |
| 47 |
}); |
| 48 |
testCases.push({ |
| 49 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language}, |
| 50 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>", |
| 51 |
value: date, |
| 52 |
expValue: longVal, |
| 53 |
comment: longCmt |
| 54 |
}); |
| 55 |
testCases.push({ |
| 56 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language}, |
| 57 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>", |
| 58 |
value: date, |
| 59 |
expValue: fullVal, |
| 60 |
comment: fullCmt |
| 61 |
}); |
| 62 |
} |
| 63 |
</script> |
| 64 |
<style type="text/css"> |
| 65 |
@import "../../themes/claro/document.css"; |
| 66 |
@import "../../themes/claro/claro.css"; |
| 67 |
@import "../css/dijitTests.css"; |
| 68 |
|
| 69 |
.title { |
| 70 |
background-color:#ddd; |
| 71 |
} |
| 72 |
|
| 73 |
.hint { |
| 74 |
background-color:#eee; |
| 75 |
} |
| 76 |
|
| 77 |
.testExample { |
| 78 |
background-color:#fbfbfb; |
| 79 |
padding:1em; |
| 80 |
margin-bottom:1em; |
| 81 |
border:1px solid #bfbfbf; |
| 82 |
} |
| 83 |
|
| 84 |
.dojoTitlePaneLabel label { |
| 85 |
font-weight:bold; |
| 86 |
} |
| 87 |
|
| 88 |
td {white-space:nowrap} |
| 89 |
</style> |
| 90 |
</head> |
| 91 |
|
| 92 |
<body class="claro"> |
| 93 |
<h1 class="testTitle">Dijit TextBox Globalization Test for Number</h1> |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
<p> |
| 98 |
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. |
| 99 |
</p> |
| 100 |
|
| 101 |
<script> |
| 102 |
(function(){ |
| 103 |
|
| 104 |
genFormatTestCases("Number Format", "dijit.form.NumberTextBox", [ |
| 105 |
{ attrs: {lang: "ar-eg"}, |
| 106 |
desc: "Locale: ar_EG", |
| 107 |
value: "12345.067", |
| 108 |
expValue: "12٬345٫067", |
| 109 |
comment: "" |
| 110 |
}, |
| 111 |
{ attrs: {lang: "ar-eg"}, |
| 112 |
desc: "Locale: ar_EG", |
| 113 |
value: "-12345.067", |
| 114 |
expValue: "12٬345٫067-", |
| 115 |
comment: "" |
| 116 |
}, |
| 117 |
|
| 118 |
{ attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 119 |
desc: "Locale: ar_EG", |
| 120 |
value: "12345.067", |
| 121 |
expValue: "١٢\u066C٣٤٥\u066B٠٦٧", |
| 122 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 123 |
}, |
| 124 |
{ attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 125 |
desc: "Locale: ar_EG", |
| 126 |
value: "-12345.067", |
| 127 |
expValue: "١٢\u066C٣٤٥\u066B٠٦٧-", |
| 128 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 129 |
}, |
| 130 |
|
| 131 |
{ attrs: {lang: "hi-in", constraints: "{localeDigit: true}"}, |
| 132 |
desc: "Locale: hi_IN", |
| 133 |
value: "123456789.068", |
| 134 |
expValue: "१२,३४,५६,७८९.०६८", |
| 135 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 136 |
}, |
| 137 |
{ attrs: {lang: "hi-in", constraints: "{localeDigit: true}"}, |
| 138 |
desc: "Locale: hi_IN", |
| 139 |
value: "-123456789.068", |
| 140 |
expValue: "-१२,३४,५६,७८९.०६८", |
| 141 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 142 |
} |
| 143 |
]); |
| 144 |
|
| 145 |
genValidateTestCases("Number Validate", "dijit.form.NumberTextBox", [ |
| 146 |
|
| 147 |
{ attrs: {lang: "ar-eg"}, |
| 148 |
desc: "Locale: ar_EG", |
| 149 |
value: 12345.067, |
| 150 |
expValue: "12٬345٫067", |
| 151 |
comment: "" |
| 152 |
}, |
| 153 |
{ attrs: {lang: "ar-eg"}, |
| 154 |
desc: "Locale: ar_EG", |
| 155 |
value: -12345.067, |
| 156 |
expValue: "12٬345٫067-", |
| 157 |
comment: "" |
| 158 |
}, |
| 159 |
|
| 160 |
{ attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 161 |
desc: "Locale: ar_EG", |
| 162 |
value: 12345.067, |
| 163 |
expValue: "١٢\u066C٣٤٥\u066B٠٦٧", |
| 164 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 165 |
}, |
| 166 |
{ attrs: {lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 167 |
desc: "Locale: ar_EG", |
| 168 |
value: -12345.067, |
| 169 |
expValue: "١٢\u066C٣٤٥\u066B٠٦٧-", |
| 170 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 171 |
}, |
| 172 |
|
| 173 |
{ attrs: {lang: "hi-in", constraints: "{localeDigit: true}"}, |
| 174 |
desc: "Locale: hi_IN", |
| 175 |
value: 123456789.068, |
| 176 |
expValue: "१२,३४,५६,७८९.०६८", |
| 177 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 178 |
}, |
| 179 |
{ attrs: {lang: "hi-in", constraints: "{localeDigit: true}"}, |
| 180 |
desc: "Locale: hi_IN", |
| 181 |
value: -123456789.068, |
| 182 |
expValue: "-१२,३४,५६,७८९.०६८", |
| 183 |
comment: "<a href='currency.html#cmt_2'>See #2 (currency.html).</a>" |
| 184 |
} |
| 185 |
]); |
| 186 |
|
| 187 |
genFormatTestCases("Currency Format", "dijit.form.CurrencyTextBox", [ |
| 188 |
|
| 189 |
{ attrs: {Currency: "EGP", lang: "ar-eg"}, |
| 190 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 191 |
value: "123456789.46", |
| 192 |
expValue: "ج.م.\u200F 123٬456٬789٫46", |
| 193 |
comment: "" |
| 194 |
}, |
| 195 |
{ attrs: {Currency: "EGP", lang: "ar-eg"}, |
| 196 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 197 |
value: "-123456789.46", |
| 198 |
expValue: "ج.م.\u200F 123٬456٬789٫46-", |
| 199 |
comment: "" |
| 200 |
}, |
| 201 |
|
| 202 |
{ attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 203 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 204 |
value: "123456789.46", |
| 205 |
expValue: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦", |
| 206 |
comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 207 |
}, |
| 208 |
{ attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 209 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 210 |
value: "-123456789.46", |
| 211 |
expValue: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-", |
| 212 |
comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 213 |
} |
| 214 |
]); |
| 215 |
|
| 216 |
genValidateTestCases("Currency Validate", "dijit.form.CurrencyTextBox", [ |
| 217 |
|
| 218 |
{ attrs: {Currency: "EGP", lang: "ar-eg"}, |
| 219 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 220 |
value: 123456789.46, |
| 221 |
expValue: "ج.م.\u200F 123٬456٬789٫46", |
| 222 |
comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 223 |
}, |
| 224 |
{ attrs: {Currency: "EGP", lang: "ar-eg"}, |
| 225 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 226 |
value: -123456789.46, |
| 227 |
expValue: "ج.م.\u200F 123٬456٬789٫46-", |
| 228 |
comment: "Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 229 |
}, |
| 230 |
|
| 231 |
{ attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 232 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 233 |
value: 123456789.46, |
| 234 |
expValue: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦", |
| 235 |
comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 236 |
}, |
| 237 |
{ attrs: {Currency: "EGP", lang: "ar-eg", constraints: "{localeDigit: true}"}, |
| 238 |
desc: "Locale: <b>ar_EG</b> Currency: <b>EGP</b>", |
| 239 |
value: -123456789.46, |
| 240 |
expValue: "ج.م.\u200F ١٢٣\u066C٤٥٦\u066C٧٨٩\u066B٤٦-", |
| 241 |
comment: "<a href='#cmt_3'>See #3.</a> Failed in Firefox. <a href='#cmt_2'>See #2.</a>" |
| 242 |
} |
| 243 |
]); |
| 244 |
|
| 245 |
var testCases = []; |
| 246 |
gen4DateFormat(testCases, "ar-eg", "ar_EG", "2005-07-31", |
| 247 |
"31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 2005", ""); |
| 248 |
gen4DateFormat(testCases, "hi-in", "hi_IN", "2005-07-31", |
| 249 |
"२००५-०७-३१", "<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>"); |
| 250 |
genFormatTestCases("Date Format", "dijit.form.DateTextBox", testCases); |
| 251 |
|
| 252 |
testCases = []; |
| 253 |
gen4DateFormat(testCases, "ar-eg", "ar_EG", new Date(2005, 6, 31), |
| 254 |
"31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 2005", ""); |
| 255 |
gen4DateFormat(testCases, "hi-in", "hi_IN", new Date(2005, 6, 31), |
| 256 |
"२००५-०७-३१", "<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>"); |
| 257 |
genValidateTestCases("Date Validate", "dijit.form.DateTextBox", testCases); |
| 258 |
|
| 259 |
})(); |
| 260 |
|
| 261 |
</script> |
| 262 |
</body> |
| 263 |
</html> |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|