web/test/unittest_form.py
branchstable
changeset 2147 476a75ede2cc
parent 2131 00e6d1cb18ea
parent 2145 529867c301fc
child 2174 7f576dc9502e
--- a/web/test/unittest_form.py	Tue Jun 23 13:34:28 2009 +0200
+++ b/web/test/unittest_form.py	Tue Jun 23 13:46:18 2009 +0200
@@ -6,6 +6,8 @@
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
 
+from xml.etree.ElementTree import fromstring
+
 from logilab.common.testlib import unittest_main, mock_object
 
 from cubicweb import Binary
@@ -13,7 +15,7 @@
 from cubicweb.web.formfields import (IntField, StringField, RichTextField,
                                      DateTimeField, DateTimePicker,
                                      FileField, EditableFileField)
-from cubicweb.web.formwidgets import PasswordInput
+from cubicweb.web.formwidgets import PasswordInput, Input
 from cubicweb.web.views.forms import EntityFieldsForm, FieldsForm
 from cubicweb.web.views.workflow import ChangeStateForm
 from cubicweb.web.views.formrenderers import FormRenderer
@@ -210,5 +212,13 @@
 <span class="emphasis">confirm password</span>''' % {'eid': self.entity.eid})
 
 
+    def test_datefield(self):
+        class DFForm(EntityFieldsForm):
+            creation_date = DateTimeField(widget=Input)
+        form = DFForm(self.req, entity=self.entity)
+        init, cur = (fromstring(self._render_entity_field(attr, form)).get('value')
+                     for attr in ('edits-creation_date', 'creation_date'))
+        self.assertEquals(init, cur)
+
 if __name__ == '__main__':
     unittest_main()