def test_error(self): _form = TestForm() _form.validate() _renderer = Renderer(_form, 'bootstrap') self.assertIn('form-group has-error', _renderer())
def test_render_bootstrap(self): _renderer = Renderer(form, 'bootstrap') self.assertIn('class="form-wrapper"', _renderer())
def test_error(self): _form = TestForm() _form.validate() _renderer = Renderer(_form, 'bootstrap') self.assertIn('form-group has-error', _renderer.field('text'))
def test_bootstrap(self): _renderer = Renderer(form, 'bootstrap') self.assertIn('form-group', _renderer.field('text')) self.assertNotIn('form-group has-error', _renderer.field('text'))
from wtforms import (TextField, validators, Form, TextAreaField, BooleanField, DateField, DateTimeField) from wtforms_extras import Renderer class TestForm(Form): text = TextField(u'Name', [validators.required()]) textarea = TextAreaField(u'Text Area') boolean = BooleanField('Boolean') date = DateField('Date') datetime = DateTimeField('DateTime') form = TestForm() renderer = Renderer(form)