def test_angular_input_field(self):
my_form = SampleForm()
template = u'{% angular_input_field my_form.name model_name params %}'
context = {'my_form': my_form,
'model_name': 'yourname',
'params': {}}
# Django 1.10 changes the rendering of boolean attributes
if VERSION[1] > 9:
output = (u'<input class="form-control" id="id_name" '
u'maxlength="100" name="name" ng-model='
u'"yourname.fields.name" type="text" required />')
else:
output = (u'<input class="form-control" id="id_name" '
u'maxlength="100" name="name" ng-model='
u'"yourname.fields.name" required="true" type="text" />')
self.tag_test(template, context, output)
# repeat test, with bound form
my_form = SampleForm({'name': 'Joe Bloggs'})
self.tag_test(template, context, output)
评论列表
文章目录