Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help select text wasn't coming through #795

Merged
merged 2 commits into from Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion opal/static/js/opaltest/directives.test.js
Expand Up @@ -94,9 +94,20 @@ describe('OPAL Directives', function(){

describe('placeholder', function() {

it('should ', function() {
it('should display the', function() {
spyOn($, "support");
$.support.placeholder = true;
var markup = '<input placeholder="foo" />';
compileDirective(markup);
expect(_.contains(element[0], 'placeholder="foo"'));
});

it('should display the', function() {
spyOn($, "support");
$.support.placeholder = false;
var markup = '<input placeholder="foo" />';
compileDirective(markup);
expect(_.contains(element[0], 'placeholder="foo"'));
});

});
Expand Down
2 changes: 0 additions & 2 deletions opal/templatetags/forms.py
Expand Up @@ -214,7 +214,6 @@ def select(*args, **kwargs):
form_name = kwargs.pop('formname', None)
other = kwargs.pop('other', False)
help_template = kwargs.pop('help', None)
help_text = kwargs.pop('help_text', None)
placeholder = kwargs.pop("placeholder", None)
visibility = _visibility_clauses(kwargs.pop('show', None),
kwargs.pop('hide', None))
Expand All @@ -240,7 +239,6 @@ def select(*args, **kwargs):
'directives': args,
'visibility': visibility,
'help_template': help_template,
'help_text': help_text,
'other': other,
'model_name': ctx["model"].replace('.', '_').replace('[','').replace(']', '').replace('editing_', ''),
'required': required,
Expand Down
5 changes: 5 additions & 0 deletions opal/tests/test_templatetags_forms.py
Expand Up @@ -179,6 +179,11 @@ def test_select_lookuplist(self):
cleaned = "".join([i.strip() for i in rendered.split("\n") if i.strip()])
self.assertIn('<label class="control-label col-sm-3">hai</label>', cleaned)

def test_help_text(self):
template = Template('{% load forms %}{% select label="hai" model="bai" lookuplist="[1,2,3]" help_text="informative help text" %}')
rendered = template.render(Context({}))
self.assertIn('informative help text', rendered)

def test_required_no_formname(self):
tpl = Template('{% load forms %}{% select label="hai" model="bai" required=True %}')
with self.assertRaises(ValueError):
Expand Down