Blaise Laflamme avatar Blaise Laflamme committed 5c45703

Fixed css_class in Widget, added selenium test.

Comments (0)

Files changed (4)

   a text input that can be supplied a URL or iterable of choices to
   ease the search and selection of a finite set of choices.
 
+- The ``deform.widget.Widget`` class now accepts an extra keyword argument in
+  its constructor: ``css_class``.
+
+  If ``css_class`` contains a value, the rendered widget will get a class
+  attribute equal to the value.
+
 
 0.3
 ---
     hidden = False
     category = 'default'
     error_class = 'error'
-    css_class = ''
+    css_class = None
 
     def __init__(self, **kw):
         self.__dict__.update(kw)

deformdemo/app.py

     
     @bfg_view(renderer='templates/form.pt', name='textinput_with_css_class')
     @demonstrate('Text Input Widget with CSS Class')
-    def textinput(self):
+    def textinput_with_css_class(self):
         class Schema(colander.Schema):
             text = colander.SchemaNode(colander.String(),
                                      validator=colander.Length(max=100),

deformdemo/tests/test_demo.py

         captured = browser.get_text('css=#captured')
         self.assertEqual(captured, "{'text': u'hello'}")
 
+class TextInputWithCssClassWidgetTests(unittest.TestCase):
+    url = "/textinput_with_css_class/"
+    def test_render_default(self):
+        browser.open(self.url)
+        browser.wait_for_page_to_load("30000")
+        self.assertTrue(browser.is_element_present('css=.deformWidgetWithStyle'))
+
 class AutocompleteInputWidgetTests(unittest.TestCase):
     url = "/autocomplete_input/"
     def test_render_default(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.