mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #20568 -- truncatewords_html no longer splits words containing HTML entities.
Thanks yann0 at hotmail.com for the report.
This commit is contained in:
parent
58d555caf5
commit
40b95a24ae
3 changed files with 13 additions and 1 deletions
|
@ -82,6 +82,15 @@ class TestUtilsText(SimpleTestCase):
|
|||
self.assertEqual('<br>The <hr/>quick <em>brown...</em>',
|
||||
truncator.words(3, '...', html=True ))
|
||||
|
||||
# Test html entities
|
||||
truncator = text.Truncator('<i>Buenos días!'
|
||||
' ¿Cómo está?</i>')
|
||||
self.assertEqual('<i>Buenos días! ¿Cómo...</i>',
|
||||
truncator.words(3, '...', html=True))
|
||||
truncator = text.Truncator('<p>I <3 python, what about you?</p>')
|
||||
self.assertEqual('<p>I <3 python...</p>',
|
||||
truncator.words(3, '...', html=True))
|
||||
|
||||
def test_wrap(self):
|
||||
digits = '1234 67 9'
|
||||
self.assertEqual(text.wrap(digits, 100), '1234 67 9')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue