Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Fixed max character count attributes on beta and release feedback pag…
Browse files Browse the repository at this point in the history
…es. Bug 628839.
  • Loading branch information
Fred Wenzel committed Jan 26, 2011
1 parent f16bc38 commit da474cb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/feedback/templates/feedback/feedback.html
Expand Up @@ -38,7 +38,7 @@ <h2>
{{ form.description.errors|safe }}

<p>{{ form.description|safe }} <span id="count" data-max="{{
form.max_length }}">{{ form.max_length }}</span></p>
form.fields.description.max_length }}">{{ form.fields.description.max_length }}</span></p>

{% if type in (OPINION_PRAISE.id, OPINION_ISSUE.id): %}
{{ form.url.errors|safe }}
Expand Down
8 changes: 4 additions & 4 deletions apps/feedback/templates/feedback/release_index.html
Expand Up @@ -131,8 +131,8 @@ <h1>{{ _('Report a Broken Website') }}</h1>
<p>{{ website_form.description|safe }}</p>
{{ website_form.description.errors|safe }}
<span id="count-broken-desc" class="count" data-max="{{
website_form.max_length }}">{{
website_form.max_length }}</span>
website_form.fields.description.max_length }}">{{
website_form.fields.description.max_length }}</span>
<p class="privacy"><span>
{% trans %}
To protect your privacy, please ensure that no personally identifiable
Expand Down Expand Up @@ -182,8 +182,8 @@ <h1>{{ _('Share an Idea') }}</h1>
<p>{{ suggestion_form.description|safe }}</p>
{{ suggestion_form.description.errors|safe }}
<span id="count-idea-desc" class="count" data-max="{{
suggestion_form.max_length }}">{{
suggestion_form.max_length }}</span>
suggestion_form.fields.description.max_length }}">{{
suggestion_form.fields.description.max_length }}</span>
<p class="privacy"><span>
{% trans %}
To protect your privacy, please ensure that no personally
Expand Down
29 changes: 28 additions & 1 deletion apps/feedback/tests/test_views.py
Expand Up @@ -177,7 +177,6 @@ def test_submission_with_device_info(self):

def test_feedback_index(self):
"""Test feedback index page for Betas."""

r = self.client.get(reverse('feedback', channel='beta'),
HTTP_USER_AGENT=(self.FX_UA % '20.0b2'),
follow=True)
Expand All @@ -186,6 +185,20 @@ def test_feedback_index(self):
for link in ('feedback.happy', 'feedback.sad'):
eq_(doc('a[href$="%s"]' % reverse(link)).length, 1)

def test_max_length(self):
"""
Ensure description's max_length attribute is propagated correctly for
JS to pick up.
"""
for link in ('feedback.happy', 'feedback.sad'):
r = self.client.get(reverse(link, channel='beta'),
HTTP_USER_AGENT=(self.FX_UA % '20.0b2'),
follow=True)
doc = pyquery.PyQuery(r.content)
eq_(doc('#count').attr('data-max'),
str(settings.MAX_FEEDBACK_LENGTH))



class ReleaseViewTests(ViewTestCase):
"""Test feedback for Firefox release versions."""
Expand Down Expand Up @@ -367,3 +380,17 @@ def test_suggestion(self):
latest = Opinion.objects.no_cache().order_by('-id')[0]
eq_(latest.description, data['description'])
latest.delete()

def test_max_length(self):
"""
Ensure description's max_length attribute is propagated correctly for
JS to pick up.
"""
r = self.client.get(reverse('feedback', channel='release'),
HTTP_USER_AGENT=(self.FX_UA % '20.0'),
follow=True)
doc = pyquery.PyQuery(r.content)
eq_(doc('#count-broken-desc').attr('data-max'),
str(settings.MAX_FEEDBACK_LENGTH))
eq_(doc('#count-idea-desc').attr('data-max'),
str(settings.MAX_SUGGESTION_LENGTH))

0 comments on commit da474cb

Please sign in to comment.