Skip to content

Commit

Permalink
[bug 697445] Fix kbforums async preview.
Browse files Browse the repository at this point in the history
* And add a test for it.
  • Loading branch information
rlr committed Oct 26, 2011
1 parent 140d0f9 commit b22ce72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/kbforums/templates/kbforums/includes/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<img src="{{ MEDIA_URL }}img/forums/delete.png" alt="{{ _('Delete') }}" title="{{ _('Delete') }}">
</a>
{% endif %}
{% if document.slug and post.id %}
{% if document and document.slug and post.id %}
<form class="report" action="{{ url('wiki.discuss.flag_post', document.slug, post.id) }}" method="post">
{% include 'wiki/includes/flag_form.html' %}
</form>
Expand Down
11 changes: 11 additions & 0 deletions apps/kbforums/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ def test_preview_reply(self):
eq_(content, doc('#post-preview div.content').text())
eq_(num_posts, t.post_set.count())

def test_preview_async(self):
"""Preview a reply."""
self.client.login(username='rrosario', password='testpass')
d = Document.objects.all()[0]
content = 'Full of awesome.'
response = post(self.client, 'wiki.discuss.post_preview_async',
{'content': content}, args=[d.slug])
eq_(200, response.status_code)
doc = pq(response.content)
eq_(content, doc('div.content').text())

def test_watch_thread(self):
"""Watch and unwatch a thread."""
self.client.login(username='rrosario', password='testpass')
Expand Down

0 comments on commit b22ce72

Please sign in to comment.