-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add timesince/until and urlize/urlizetrunc filters
- Loading branch information
Anders Hellerup Madsen
committed
Jan 21, 2010
1 parent
ece9831
commit 87c7718
Showing
7 changed files
with
267 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,5 +25,42 @@ testcase('truncate_html_words'); | |
test('should close tags on truncate', function () { | ||
assertEquals('<p>Joel is ...</p>', truncate_html_words('<p>Joel is a slug</p>', 2)); | ||
}); | ||
testcase('urlize') | ||
test('should urlize urls in text', function () { | ||
assertEquals( | ||
'Check out <a href="http://www.djangoproject.com">www.djangoproject.com</a>', | ||
urlize('Check out www.djangoproject.com') | ||
); | ||
assertEquals( | ||
'Check out (<a href="http://www.djangoproject.com">www.djangoproject.com</a>)', | ||
urlize('Check out (www.djangoproject.com)') | ||
); | ||
assertEquals( | ||
'Skriv til <a href="mailto:[email protected]">[email protected]</a>', | ||
urlize('Skriv til [email protected]') | ||
); | ||
assertEquals( | ||
'Check out (<a href="http://www.djangoproject.com">www.djangoproject.com</a>)\n' + | ||
'Skriv til <a href="mailto:[email protected]">[email protected]</a>', | ||
urlize('Check out (www.djangoproject.com)\nSkriv til [email protected]') | ||
); | ||
assertEquals( | ||
'Check out <a href="http://www.djangoproject.com">www.djangopr...</a>', | ||
urlize('Check out www.djangoproject.com', {limit: 15}) | ||
); | ||
assertEquals( | ||
'Se her: (<a href="http://www.dr.dk">www.dr.dk</a> & ' + | ||
'<a href="http://www.djangoproject.com">http://www.djangoproject.com</a>)', | ||
urlize('Se her: (www.dr.dk & http://www.djangoproject.com)', { escape: true }) | ||
); | ||
assertEquals( | ||
'Se her: <a href="http://www.dr.dk?hest=4&test=tolv">www.dr.dk?hest=4&test=tolv</a>.', | ||
urlize('Se her: www.dr.dk?hest=4&test=tolv.', { escape: true }) | ||
); | ||
assertEquals( | ||
'Check out (<a href="http://www.djangoproject.com" rel="nofollow">www.djangoproject.com</a>)', | ||
urlize('Check out (www.djangoproject.com)', { nofollow: true }) | ||
); | ||
}); | ||
|
||
run(); |