Kotti / deform_bootstrap

Bootstrap compatible templates for the deform form library. (Merged into deform 2.)
http://pypi.python.org/pypi/deform_bootstrap
34 stars 30 forks source link

Add support for 'inline' checkbox and radio choices #18

Closed dairiki closed 12 years ago

dairiki commented 12 years ago

Great work on deform_bootstrap!

Here are two small patches. The first adds documentation on the Form.bootstrap_form_style attribute. The second adds support for CheckboxChoiceWidget.inline and RadioChoiceWidget.inline attributes to display the choices inline as opposed to one per line.

(Sorry, I can't get the selenium tests to pass here right now. It might have to do with the fact that I am running python 2.6; or it could just be because I'm clueless about selenium. In any case, since I can't get the tests to pass on a clean codebase, I have not written tests for my changes.)

dnouri commented 12 years ago

Thanks!

The 'inline' is adding only a class so I figured we could do without a Selenium test.

Nevertheless, maybe I can help you with your Selenium setup problem? What I do to run the Selenium tests (always relative to my venv):

$ java -jar ~/lib/selenium-server-standalone-2.17.0.jar
... starts Selenium server in foreground ...
$ bin/pserve demo.ini
... starts demo app in foreground ...
$ bin/python deform_bootstrap/demo/test.py
... runs selenium tests ...

Which one of these is failing?

dairiki commented 12 years ago

Hi Daniel,

On Thu, Mar 08, 2012 at 03:55:17PM -0800, Daniel Nouri wrote:

Thanks!

No problem. Thank you for putting the package together.

The 'inline' is adding only a class so I figured we could do without a Selenium test.

Fine by me.

Nevertheless, maybe I can help you with your Selenium setup problem? What I do to run the Selenium tests (always relative to my venv):

Okay, nevermind. It turns out I had made some local modifications to my copy of deformdemo which were causing the test failures. When I use a pristine copy of deformdemo, all tests run fine. (I have administered a suitable dope slap to myself.)

I'm still clueless w.r.t selenium. I know what it is (supposed) to do — and that seems awesome — but have not yet read the docs or figured out how to write a test. It's on the to-do list.

Cheers, Jeff

dnouri commented 12 years ago

deformdemo has many tests that you could steal/get inspiration from. An example from its test.py:

class CheckboxChoiceWidgetTests(Base, unittest.TestCase):
    url = "/checkboxchoice/"
    def test_render_default(self):
        browser.open(self.url)
        browser.wait_for_page_to_load("30000")
        self.assertTrue(browser.is_text_present("Pepper"))
        self.assertFalse(browser.is_checked("deformField1-0"))
        self.assertFalse(browser.is_checked("deformField1-1"))
        self.assertFalse(browser.is_checked("deformField1-2"))
        self.assertEqual(browser.get_text('css=.req'), '*')
        self.assertEqual(browser.get_text('css=#captured'), 'None')