[Dojo-checkins] bill - r27079 - in dijit/trunk: . tests

dojo-checkins-admin at dojotoolkit.org dojo-checkins-admin at dojotoolkit.org
Tue Nov 22 02:49:02 EST 2011


Author: bill
Date: Mon Nov 21 23:49:02 2011
New Revision: 27079

Added:
   dijit/trunk/tests/CalendarLite.html   (contents, props changed)
      - copied, changed from r27060, dijit/trunk/tests/test_CalendarLite.html
Removed:
   dijit/trunk/tests/test_CalendarLite.html
Modified:
   dijit/trunk/CalendarLite.js
   dijit/trunk/tests/general-module.js
Log:
Allow Calendar to accept a string for setting the value, like _DateTimeTextBox, fixes #14139 !strict.

Modified: dijit/trunk/CalendarLite.js
==============================================================================
--- dijit/trunk/CalendarLite.js	(original)
+++ dijit/trunk/CalendarLite.js	Mon Nov 21 23:49:02 2011
@@ -4,6 +4,7 @@
 	"dojo/cldr/supplemental", // cldrSupplemental.getFirstDayOfWeek
 	"dojo/date", // date
 	"dojo/date/locale",
+	"dojo/date/stamp", // stamp.fromISOString
 	"dojo/dom", // dom.setSelectable
 	"dojo/dom-class", // domClass.contains
 	"dojo/_base/event", // event.stop
@@ -14,7 +15,7 @@
 	"./_WidgetBase",
 	"./_TemplatedMixin",
 	"dojo/text!./templates/Calendar.html"
-], function(array, declare, cldrSupplemental, date, local, dom, domClass, event, lang, has, string, win,
+], function(array, declare, cldrSupplemental, date, locale, stamp, dom, domClass, event, lang, has, string, win,
 			_WidgetBase, _TemplatedMixin, template){
 
 /*=====
@@ -123,6 +124,9 @@
 			//		Either a Date or the number of seconds since 1970.
 			// tags:
 			//      protected
+			if(typeof value == "string"){
+				value = stamp.fromISOString(value);
+			}
 			if(value){
 				// convert from Number to Date, or make copy of Date object so that setHours() call below
 				// doesn't affect original value

Copied: dijit/trunk/tests/CalendarLite.html (from r27060, dijit/trunk/tests/test_CalendarLite.html)
==============================================================================
--- dijit/trunk/tests/test_CalendarLite.html	(original)
+++ dijit/trunk/tests/CalendarLite.html	Mon Nov 21 23:49:02 2011
@@ -21,14 +21,23 @@
 		<script type="text/javascript" src="_testCommon.js"></script>
 
 		<script type="text/javascript">
-			dojo.require("dijit.CalendarLite");
+			require(["doh/runner", "dojo/date/stamp", "dojo/dom", "dijit/CalendarLite", "dojo/domReady!"],
+					function(doh, stamp, dom, CalendarLite){
 
-			dojo.ready(function(){
-				new dijit.CalendarLite({
-					onChange: function myHandler(id,newValue){
-						console.debug("onChange for id = " + id + ", value: " + newValue);
+				doh.register("CalendarLite", [
+					function create(){
+						var cal = new CalendarLite({
+							id: "cal",
+							value: "1999-12-31",
+							onChange: function myHandler(id,newValue){
+								console.debug("onChange for id = " + id + ", value: " + newValue);
+							}
+						}, dom.byId("calendar1"));
+
+						doh.is("1999-12-31", stamp.toISOString(cal.get("value"), {selector: "date"}), "value");
 					}
-				}, dojo.byId("calendar1"));
+				]);
+				doh.run();
 			});
 		</script>
 	</head>

Modified: dijit/trunk/tests/general-module.js
==============================================================================
--- dijit/trunk/tests/general-module.js	(original)
+++ dijit/trunk/tests/general-module.js	Mon Nov 21 23:49:02 2011
@@ -29,6 +29,7 @@
 	
 	doh.registerUrl("dijit.tests.robot.ColorPalette", dojo.moduleUrl("dijit","tests/robot/ColorPalette.html"+userArgs), 999999);
 
+	doh.registerUrl("dijit.tests.CalendarLite", dojo.moduleUrl("dijit","tests/CalendarLite.html"+userArgs), 999999);
 	doh.registerUrl("dijit.tests.robot.Calendar_a11y", dojo.moduleUrl("dijit","tests/robot/Calendar_a11y.html"+userArgs), 999999);
 
 	doh.registerUrl("dijit.tests.robot.TitlePane", dojo.moduleUrl("dijit","tests/robot/TitlePane.html"+userArgs), 999999);


More information about the Dojo-checkins mailing list