summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2012-01-02 18:47:18 +0000
committerJulien Phalip <jphalip@gmail.com>2012-01-02 18:47:18 +0000
commit1572a3d4b2dd4afd004765ba73a2c38b311b65ee (patch)
tree97745fc4fef82eae07b4fdc160db41dea2dcb26e /tests
parent6fa62b8166f00d6cf1160b84dce37416f0051f00 (diff)
Fixed #10931 -- Made `Truncator` handle newlines properly. Thanks to gsong and Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/utils/text.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/text.py b/tests/regressiontests/utils/text.py
index d4aa53fba9..aae75339bc 100644
--- a/tests/regressiontests/utils/text.py
+++ b/tests/regressiontests/utils/text.py
@@ -62,6 +62,11 @@ class TestUtilsText(unittest.TestCase):
'</strong></p>', truncator.words(4, '....', html=True))
self.assertEqual(u'<p><strong><em>The quick brown fox</em></strong>'
'</p>', truncator.words(4, '', html=True))
+ # Test with new line inside tag
+ truncator = text.Truncator('<p>The quick <a href="xyz.html"\n'
+ 'id="mylink">brown fox</a> jumped over the lazy dog.</p>')
+ self.assertEqual(u'<p>The quick <a href="xyz.html"\n'
+ 'id="mylink">brown...</a></p>', truncator.words(3, '...', html=True))
def test_old_truncate_words(self):
self.assertEqual(u'The quick brown fox jumped over the lazy dog.',