| 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 DateTextBox</title> |
| 7 |
|
| 8 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 9 |
data-dojo-config="isDebug: true, extraLocale: ['zh-cn','fr-fr','ja-jp','ru-ru','en-us','de-de','es-es','it-it','pt-br','ko-kr','zh-tw']"></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 |
<style type="text/css"> |
| 33 |
@import "../../themes/claro/document.css"; |
| 34 |
@import "../../themes/claro/claro.css"; |
| 35 |
@import "../css/dijitTests.css"; |
| 36 |
|
| 37 |
.title { |
| 38 |
background-color:#ddd; |
| 39 |
} |
| 40 |
|
| 41 |
.hint { |
| 42 |
background-color:#eee; |
| 43 |
} |
| 44 |
|
| 45 |
.testExample { |
| 46 |
background-color:#fbfbfb; |
| 47 |
padding:1em; |
| 48 |
margin-bottom:1em; |
| 49 |
border:1px solid #bfbfbf; |
| 50 |
} |
| 51 |
|
| 52 |
.dojoTitlePaneLabel label { |
| 53 |
font-weight:bold; |
| 54 |
} |
| 55 |
|
| 56 |
td {white-space:nowrap} |
| 57 |
</style> |
| 58 |
<script> |
| 59 |
function gen4DateFormat(testCases, language, locale, date, short, shortCmt, medium, mediumCmt, long, longCmt, full, fullCmt){ |
| 60 |
testCases.push({ |
| 61 |
attrs: {constraints: "{formatLength:'short'}", lang: language}, |
| 62 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>", |
| 63 |
value: date, |
| 64 |
expValue: short, |
| 65 |
comment: shortCmt |
| 66 |
}); |
| 67 |
testCases.push({ |
| 68 |
attrs: {constraints: "{formatLength:'medium'}", lang: language}, |
| 69 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>", |
| 70 |
value: date, |
| 71 |
expValue: medium, |
| 72 |
comment: mediumCmt |
| 73 |
}); |
| 74 |
testCases.push({ |
| 75 |
attrs: {constraints: "{formatLength:'long'}", lang: language}, |
| 76 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>", |
| 77 |
value: date, |
| 78 |
expValue: long, |
| 79 |
comment: longCmt |
| 80 |
}); |
| 81 |
testCases.push({ |
| 82 |
attrs: {constraints: "{formatLength:'full'}", lang: language}, |
| 83 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>", |
| 84 |
value: date, |
| 85 |
expValue: full, |
| 86 |
comment: fullCmt |
| 87 |
}); |
| 88 |
} |
| 89 |
</script> |
| 90 |
</head> |
| 91 |
|
| 92 |
<body class="claro"> |
| 93 |
<h1 class="testTitle">Dijit TextBox Globalization Test for Date</h1> |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
<p> |
| 98 |
Before start this test, make sure the <b>dojo/cldr/nls</b> contains the data for "zh-cn", "fr-fr", "ja-jp", "ru-ru", "hi-in", "en-us" and "ar-eg". If not, convert these CLDR data and put them there. |
| 99 |
</p> |
| 100 |
|
| 101 |
<script> |
| 102 |
(function(){ |
| 103 |
var testCases = []; |
| 104 |
gen4DateFormat(testCases, "ru-ru", "ru_RU", "2005-07-31", |
| 105 |
"31.07.05", "", "31.07.2005", "", "31 июля 2005 г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>", "31 июля 2005 г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>"); |
| 106 |
gen4DateFormat(testCases, "zh-cn", "zh_CN", "2005-07-31", |
| 107 |
"05-7-31", "", "2005-7-31", "", "2005年7月31日", "", "2005年7月31日星期日", ""); |
| 108 |
gen4DateFormat(testCases, "en-us", "en_US", "2005-07-31", |
| 109 |
"7/31/05", "", "Jul 31, 2005", "", "July 31, 2005", "", "Sunday, July 31, 2005", ""); |
| 110 |
gen4DateFormat(testCases, "fr-fr", "fr_FR", "2005-07-31", |
| 111 |
"31/07/05", "", "31 juil. 2005", "", "31 juillet 2005", "", "dimanche 31 juillet 2005", ""); |
| 112 |
gen4DateFormat(testCases, "ja-jp", "ja_JP", "2005-07-31", |
| 113 |
"05/07/31", "", "2005/07/31", "", "2005年7月31日", "", "2005年7月31日日曜日", ""); |
| 114 |
gen4DateFormat(testCases, "de-de", "de_DE", "2005-07-31", |
| 115 |
"31.07.05", "", "31.07.2005", "", "31. Juli 2005", "", "Sonntag, 31. Juli 2005", ""); |
| 116 |
gen4DateFormat(testCases, "es-es", "es_ES", "2005-07-31", |
| 117 |
"31/07/05", "", "31/07/2005", "", "31 de julio de 2005", "", "domingo 31 de julio de 2005", ""); |
| 118 |
gen4DateFormat(testCases, "pt-br", "pt-BR", "2005-07-31", |
| 119 |
"31/07/05", "", "31/07/2005", "", "31 de julho de 2005", "", "domingo, 31 de julho de 2005", ""); |
| 120 |
gen4DateFormat(testCases, "it-it", "it-IT", "2005-07-31", |
| 121 |
"31/07/05", "", "31/lug/2005", "", "31 luglio 2005", "", "domenica 31 luglio 2005", ""); |
| 122 |
gen4DateFormat(testCases, "ko-kr", "ko-KR", "2005-07-31", |
| 123 |
"05. 7. 31.", "", "2005. 7. 31.", "", "2005년 7월 31일", "", "2005년 7월 31일 일요일", ""); |
| 124 |
gen4DateFormat(testCases, "zh-tw", "zh-TW", "2005-07-31", |
| 125 |
"2005/7/31", "", "2005/7/31", "", "2005年7月31日", "", "2005年7月31日星期日", ""); |
| 126 |
genFormatTestCases("Date Format", "dijit.form.DateTextBox", testCases); |
| 127 |
|
| 128 |
testCases = []; |
| 129 |
gen4DateFormat(testCases, "ru-ru", "ru_RU", new Date(2005, 6, 31), |
| 130 |
"31.07.05", "", "31.07.2005", "", "31 июля 2005 г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>", "31 июля 2005 г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>"); |
| 131 |
gen4DateFormat(testCases, "zh-cn", "zh_CN", new Date(2005, 6, 31), |
| 132 |
"05-7-31", "", "2005-7-31", "", "2005年7月31日", "", "2005年7月31日星期日", ""); |
| 133 |
gen4DateFormat(testCases, "en-us", "en_US", new Date(2005, 6, 31), |
| 134 |
"7/31/05", "", "Jul 31, 2005", "", "July 31, 2005", "", "Sunday, July 31, 2005", ""); |
| 135 |
gen4DateFormat(testCases, "fr-fr", "fr_FR", new Date(2005, 6, 31), |
| 136 |
"31/07/05", "", "31 juil. 2005", "", "31 juillet 2005", "", "dimanche 31 juillet 2005", ""); |
| 137 |
gen4DateFormat(testCases, "ja-jp", "ja_JP", new Date(2005, 6, 31), |
| 138 |
"05/07/31", "", "2005/07/31", "", "2005年7月31日", "", "2005年7月31日日曜日", ""); |
| 139 |
gen4DateFormat(testCases, "de-de", "de_DE", new Date(2005, 6, 31), |
| 140 |
"31.07.05", "", "31.07.2005", "", "31. Juli 2005", "", "Sonntag, 31. Juli 2005", ""); |
| 141 |
gen4DateFormat(testCases, "es-es", "es_ES", new Date(2005, 6, 31), |
| 142 |
"31/07/05", "", "31/07/2005", "", "31 de julio de 2005", "", "domingo 31 de julio de 2005", ""); |
| 143 |
gen4DateFormat(testCases, "pt-br", "pt-BR", new Date(2005, 6, 31), |
| 144 |
"31/07/05", "", "31/07/2005", "", "31 de julho de 2005", "", "domingo, 31 de julho de 2005", ""); |
| 145 |
gen4DateFormat(testCases, "it-it", "it-IT", new Date(2005, 6, 31), |
| 146 |
"31/07/05", "", "31/lug/2005", "", "31 luglio 2005", "", "domenica 31 luglio 2005", ""); |
| 147 |
gen4DateFormat(testCases, "ko-kr", "ko-KR", new Date(2005, 6, 31), |
| 148 |
"05. 7. 31.", "", "2005. 7. 31.", "", "2005년 7월 31일", "", "2005년 7월 31일 일요일", ""); |
| 149 |
gen4DateFormat(testCases, "zh-tw", "zh-TW", new Date(2005, 6, 31), |
| 150 |
"2005/7/31", "", "2005/7/31", "", "2005年7月31日", "", "2005年7月31日星期日", ""); |
| 151 |
genValidateTestCases("Date Validate", "dijit.form.DateTextBox", testCases); |
| 152 |
})(); |
| 153 |
</script> |
| 154 |
</body> |
| 155 |
</html> |