[Commits] r2560 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Thu Jan 13 11:24:11 CET 2011


Author: elemoine
Date: 2011-01-13 11:24:11 +0100 (Thu, 13 Jan 2011)
New Revision: 2560

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/form.js
   core/trunk/geoext/tests/lib/GeoExt/widgets/form.html
   core/trunk/geoext/tests/lib/GeoExt/widgets/form.js
Log:
make recordToField conform to the ISO8601 standard and support the xsd:date type, p=fvanerbiest,me r=tschaub,me (closes #379)

Modified: core/trunk/geoext/lib/GeoExt/widgets/form.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/form.js	2011-01-13 07:53:50 UTC (rev 2559)
+++ core/trunk/geoext/lib/GeoExt/widgets/form.js	2011-01-13 10:24:11 UTC (rev 2560)
@@ -159,7 +159,8 @@
         field = {
             xtype: "datefield",
             fieldLabel: label,
-            name: name
+            name: name,
+            format: 'c'
         };
     }
 
@@ -181,6 +182,6 @@
         "^(boolean)$", "i"
     ),
     "date": new RegExp(
-        "^(dateTime)$", "i"
+        "^(date|dateTime)$", "i"
     )
 };

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/form.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/form.html	2011-01-13 07:53:50 UTC (rev 2559)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/form.html	2011-01-13 10:24:11 UTC (rev 2560)
@@ -210,7 +210,7 @@
     }
 
     function test_recordToField(t) {
-        t.plan(13);
+        t.plan(17);
 
         // set up
 
@@ -253,8 +253,22 @@
 
         field = GeoExt.form.recordToField(store.getAt(3));
         field = Ext.ComponentMgr.create(field);
+        t.ok(field instanceof Ext.form.DateField, "[datetime] field is a checkbox");
+        t.eq(field.name, "DATETIME", "[datetime] field name is correct");
+        field.setValue("2001-10-26T21:32:52+02:00");
+        t.ok(field.getValue() instanceof Date, "[datetime] getValue returns a Date");
+
+        field = GeoExt.form.recordToField(store.getAt(4));
+        field = Ext.ComponentMgr.create(field);
         t.ok(field instanceof Ext.form.DateField, "[date] field is a checkbox");
         t.eq(field.name, "DATE", "[date] field name is correct");
+        field.setValue("2001-10-26");
+        t.ok(field.getValue() instanceof Date, "[date] getValue returns a Date");
+        // the following test fails because Ext's Date.dateParse function does not
+        // handle timezone offsets for date only representations
+        // (see <http://trac.geoext.org/ticket/379#comment:2>)
+        //field.setValue("2001-10-26+02:00");
+        //t.ok(field.getValue() instanceof Date, "[date] getValue returns a Date");
 
         // tear down
     }

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/form.js
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/form.js	2011-01-13 07:53:50 UTC (rev 2559)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/form.js	2011-01-13 10:24:11 UTC (rev 2560)
@@ -24,7 +24,8 @@
             '</xsd:simpleType>' +
           '</xsd:element>' +
           '<xsd:element maxOccurs="1" minOccurs="0" name="BOOLEAN" nillable="true" type="xsd:boolean"/>' +
-          '<xsd:element maxOccurs="1" minOccurs="0" name="DATE" nillable="true" type="xsd:dateTime"/>' +
+          '<xsd:element maxOccurs="1" minOccurs="0" name="DATETIME" nillable="true" type="xsd:dateTime"/>' +
+          '<xsd:element maxOccurs="1" minOccurs="0" name="DATE" nillable="true" type="xsd:date"/>' +
           '<xsd:element maxOccurs="1" minOccurs="0" name="STATE_FIPS" nillable="true" type="xsd:string"/>' +
           '<xsd:element maxOccurs="1" minOccurs="0" name="SUB_REGION" nillable="true" type="xsd:string"/>' +
           '<xsd:element maxOccurs="1" minOccurs="0" name="STATE_ABBR" nillable="true" type="xsd:string"/>' +



More information about the Commits mailing list