2150 |
mathias |
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 |
djConfig="isDebug: true, extraLocale: ['zh-cn','fr-fr','ja-jp','ar-eg','ru-ru','hi-in','en-us']"></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 |
<script>
|
|
|
57 |
function gen4DateFormat(testCases, language, locale, date, short, shortCmt, medium, mediumCmt, long, longCmt, full, fullCmt) {
|
|
|
58 |
testCases.push({
|
|
|
59 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
|
|
|
60 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
|
|
|
61 |
value: date,
|
|
|
62 |
expValue: short,
|
|
|
63 |
comment: shortCmt
|
|
|
64 |
});
|
|
|
65 |
testCases.push({
|
|
|
66 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
|
|
|
67 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
|
|
|
68 |
value: date,
|
|
|
69 |
expValue: medium,
|
|
|
70 |
comment: mediumCmt
|
|
|
71 |
});
|
|
|
72 |
testCases.push({
|
|
|
73 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
|
|
|
74 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
|
|
|
75 |
value: date,
|
|
|
76 |
expValue: long,
|
|
|
77 |
comment: longCmt
|
|
|
78 |
});
|
|
|
79 |
testCases.push({
|
|
|
80 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
|
|
|
81 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
|
|
|
82 |
value: date,
|
|
|
83 |
expValue: full,
|
|
|
84 |
comment: fullCmt
|
|
|
85 |
});
|
|
|
86 |
}
|
|
|
87 |
</script>
|
|
|
88 |
</head>
|
|
|
89 |
|
|
|
90 |
<body class="tundra">
|
|
|
91 |
<h1 class="testTitle">Dijit TextBox Globalization Test for Date</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 "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.
|
|
|
97 |
</p>
|
|
|
98 |
|
|
|
99 |
<script>
|
|
|
100 |
(function() {
|
|
|
101 |
var testCases;
|
|
|
102 |
|
|
|
103 |
testCases = new Array();
|
|
|
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. 05", "", "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, "ar-eg", "ar_EG", "2005-07-31",
|
|
|
115 |
"31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 2005", "");
|
|
|
116 |
gen4DateFormat(testCases, "hi-in", "hi_IN", "2005-07-31",
|
|
|
117 |
"३१-७-०५", "<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>");
|
|
|
118 |
genFormatTestCases("Date Format", "dijit.form.DateTextBox", testCases);
|
|
|
119 |
|
|
|
120 |
testCases = new Array();
|
|
|
121 |
gen4DateFormat(testCases, "ru-ru", "ru_RU", new Date(2005, 6, 31),
|
|
|
122 |
"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>");
|
|
|
123 |
gen4DateFormat(testCases, "zh-cn", "zh_CN", new Date(2005, 6, 31),
|
|
|
124 |
"05-7-31", "", "2005-7-31", "", "2005年7月31日", "", "2005年7月31日星期日", "");
|
|
|
125 |
gen4DateFormat(testCases, "en-us", "en_US", new Date(2005, 6, 31),
|
|
|
126 |
"7/31/05", "", "Jul 31, 2005", "", "July 31, 2005", "", "Sunday, July 31, 2005", "");
|
|
|
127 |
gen4DateFormat(testCases, "fr-fr", "fr_FR", new Date(2005, 6, 31),
|
|
|
128 |
"31/07/05", "", "31 juil. 05", "", "31 juillet 2005", "", "dimanche 31 juillet 2005", "");
|
|
|
129 |
gen4DateFormat(testCases, "ja-jp", "ja_JP", new Date(2005, 6, 31),
|
|
|
130 |
"05/07/31", "", "2005/07/31", "", "2005年7月31日", "", "2005年7月31日日曜日", "");
|
|
|
131 |
gen4DateFormat(testCases, "ar-eg", "ar_EG", new Date(2005, 6, 31),
|
|
|
132 |
"31/7/2005", "", "31/07/2005", "", "31 يوليو, 2005", "", "الأحد, 31 يوليو, 2005", "");
|
|
|
133 |
gen4DateFormat(testCases, "hi-in", "hi_IN", new Date(2005, 6, 31),
|
|
|
134 |
"३१-७-०५", "<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>");
|
|
|
135 |
genValidateTestCases("Date Validate", "dijit.form.DateTextBox", testCases);
|
|
|
136 |
|
|
|
137 |
dojo.parser.parse();
|
|
|
138 |
|
|
|
139 |
})();
|
|
|
140 |
|
|
|
141 |
</script>
|
|
|
142 |
</body>
|
|
|
143 |
</html>
|
|
|
144 |
|
|
|
145 |
<!--
|
|
|
146 |
testCases.push({
|
|
|
147 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
|
|
|
148 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
|
|
|
149 |
value: date,
|
|
|
150 |
expValue: short,
|
|
|
151 |
comment: shortCmt
|
|
|
152 |
});
|
|
|
153 |
testCases.push({
|
|
|
154 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
|
|
|
155 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
|
|
|
156 |
value: date,
|
|
|
157 |
expValue: medium,
|
|
|
158 |
comment: mediumCmt
|
|
|
159 |
});
|
|
|
160 |
testCases.push({
|
|
|
161 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
|
|
|
162 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
|
|
|
163 |
value: date,
|
|
|
164 |
expValue: long,
|
|
|
165 |
comment: longCmt
|
|
|
166 |
});
|
|
|
167 |
testCases.push({
|
|
|
168 |
attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
|
|
|
169 |
desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
|
|
|
170 |
value: date,
|
|
|
171 |
expValue: full,
|
|
|
172 |
comment: fullCmt
|
|
|
173 |
-->
|