date.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. <script type="text/javascript" src="../../../dojo/dojo.js"
  8. djConfig="isDebug: true, extraLocale: ['zh-cn','fr-fr','ja-jp','ar-eg','ru-ru','hi-in','en-us']"></script>
  9. <script type="text/javascript" src="../../../dojo/currency.js"></script>
  10. <script type="text/javascript" src="../../../dojo/number.js"></script>
  11. <script type="text/javascript">
  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.addOnLoad(function(){
  24. doh.register("t", getAllTestCases());
  25. doh.run();
  26. });
  27. </script>
  28. <style type="text/css">
  29. @import "../../../dojo/resources/dojo.css";
  30. @import "../../themes/tundra/tundra.css";
  31. @import "../css/dijitTests.css";
  32. .title {
  33. background-color:#ddd;
  34. }
  35. .hint {
  36. background-color:#eee;
  37. }
  38. .testExample {
  39. background-color:#fbfbfb;
  40. padding:1em;
  41. margin-bottom:1em;
  42. border:1px solid #bfbfbf;
  43. }
  44. .dojoTitlePaneLabel label {
  45. font-weight:bold;
  46. }
  47. td {white-space:nowrap}
  48. </style>
  49. <script>
  50. function gen4DateFormat(testCases, language, locale, date, short, shortCmt, medium, mediumCmt, long, longCmt, full, fullCmt) {
  51. testCases.push({
  52. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
  53. desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
  54. value: date,
  55. expValue: short,
  56. comment: shortCmt
  57. });
  58. testCases.push({
  59. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
  60. desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
  61. value: date,
  62. expValue: medium,
  63. comment: mediumCmt
  64. });
  65. testCases.push({
  66. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
  67. desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
  68. value: date,
  69. expValue: long,
  70. comment: longCmt
  71. });
  72. testCases.push({
  73. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
  74. desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
  75. value: date,
  76. expValue: full,
  77. comment: fullCmt
  78. });
  79. }
  80. </script>
  81. </head>
  82. <body class="tundra">
  83. <h1 class="testTitle">Dijit TextBox Globalization Test for Date</h1>
  84. <!-- <h2 class="testTitle">Press the following button to start all test after this page is loaded.</h2>
  85. <button id="startButton" onclick="startTest()">Start Test</button>-->
  86. <p>
  87. 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.
  88. </p>
  89. <script>
  90. (function() {
  91. var testCases;
  92. testCases = new Array();
  93. gen4DateFormat(testCases, "ru-ru", "ru_RU", "2005-07-31",
  94. "31.07.05", "", "31.07.2005", "", "31 июля 2005&nbsp;г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>", "31 июля 2005&nbsp;г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>");
  95. gen4DateFormat(testCases, "zh-cn", "zh_CN", "2005-07-31",
  96. "05-7-31", "", "2005-7-31", "", "2005年7月31日", "", "2005年7月31日星期日", "");
  97. gen4DateFormat(testCases, "en-us", "en_US", "2005-07-31",
  98. "7/31/05", "", "Jul 31, 2005", "", "July 31, 2005", "", "Sunday, July 31, 2005", "");
  99. gen4DateFormat(testCases, "fr-fr", "fr_FR", "2005-07-31",
  100. "31/07/05", "", "31 juil. 05", "", "31 juillet 2005", "", "dimanche 31 juillet 2005", "");
  101. gen4DateFormat(testCases, "ja-jp", "ja_JP", "2005-07-31",
  102. "05/07/31", "", "2005/07/31", "", "2005年7月31日", "", "2005年7月31日日曜日", "");
  103. gen4DateFormat(testCases, "ar-eg", "ar_EG", "2005-07-31",
  104. "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", "");
  105. gen4DateFormat(testCases, "hi-in", "hi_IN", "2005-07-31",
  106. "३१-७-०५", "<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>");
  107. genFormatTestCases("Date Format", "dijit.form.DateTextBox", testCases);
  108. testCases = new Array();
  109. gen4DateFormat(testCases, "ru-ru", "ru_RU", new Date(2005, 6, 31),
  110. "31.07.05", "", "31.07.2005", "", "31 июля 2005&nbsp;г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>", "31 июля 2005&nbsp;г.", "Failed in Firefox. <a href='currency.html#cmt_1'>See #1 (currency.html).</a>");
  111. gen4DateFormat(testCases, "zh-cn", "zh_CN", new Date(2005, 6, 31),
  112. "05-7-31", "", "2005-7-31", "", "2005年7月31日", "", "2005年7月31日星期日", "");
  113. gen4DateFormat(testCases, "en-us", "en_US", new Date(2005, 6, 31),
  114. "7/31/05", "", "Jul 31, 2005", "", "July 31, 2005", "", "Sunday, July 31, 2005", "");
  115. gen4DateFormat(testCases, "fr-fr", "fr_FR", new Date(2005, 6, 31),
  116. "31/07/05", "", "31 juil. 05", "", "31 juillet 2005", "", "dimanche 31 juillet 2005", "");
  117. gen4DateFormat(testCases, "ja-jp", "ja_JP", new Date(2005, 6, 31),
  118. "05/07/31", "", "2005/07/31", "", "2005年7月31日", "", "2005年7月31日日曜日", "");
  119. gen4DateFormat(testCases, "ar-eg", "ar_EG", new Date(2005, 6, 31),
  120. "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", "");
  121. gen4DateFormat(testCases, "hi-in", "hi_IN", new Date(2005, 6, 31),
  122. "३१-७-०५", "<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>");
  123. genValidateTestCases("Date Validate", "dijit.form.DateTextBox", testCases);
  124. dojo.parser.parse();
  125. })();
  126. </script>
  127. </body>
  128. </html>
  129. <!--
  130. testCases.push({
  131. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'short', localeDigit: true}" : "{formatLength:'short'}", lang: language},
  132. desc: "Locale: <b>" + locale + "</b> Format: <b>Short</b>",
  133. value: date,
  134. expValue: short,
  135. comment: shortCmt
  136. });
  137. testCases.push({
  138. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'medium', localeDigit: true}" : "{formatLength:'medium'}", lang: language},
  139. desc: "Locale: <b>" + locale + "</b> Format: <b>Medium</b>",
  140. value: date,
  141. expValue: medium,
  142. comment: mediumCmt
  143. });
  144. testCases.push({
  145. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'long', localeDigit: true}" : "{formatLength:'long'}", lang: language},
  146. desc: "Locale: <b>" + locale + "</b> Format: <b>Long</b>",
  147. value: date,
  148. expValue: long,
  149. comment: longCmt
  150. });
  151. testCases.push({
  152. attrs: {constraints: language.indexOf("hi") == 0 ? "{formatLength:'full', localeDigit: true}" : "{formatLength:'full'}", lang: language},
  153. desc: "Locale: <b>" + locale + "</b> Format: <b>Full</b>",
  154. value: date,
  155. expValue: full,
  156. comment: fullCmt
  157. -->