From 0879e4e296afc7ab69ac8d77659d7ddaaf2b801a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 20 Jan 2015 01:33:26 +0100 Subject: [PATCH] Added tests. --- .../javascripts/app/lib/app_post/utils.js.coffee | 2 +- public/assets/tests/html-utils.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/lib/app_post/utils.js.coffee b/app/assets/javascripts/app/lib/app_post/utils.js.coffee index 6690bf4e7..0ae38e317 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.js.coffee @@ -114,7 +114,7 @@ class App.Utils @_removeAttributes( html ) # remove tags, keep content - html.find('a, font').replaceWith( -> + html.find('a, font, small, time').replaceWith( -> $(@).contents() ) diff --git a/public/assets/tests/html-utils.js b/public/assets/tests/html-utils.js index fff291fe2..6073961e2 100644 --- a/public/assets/tests/html-utils.js +++ b/public/assets/tests/html-utils.js @@ -296,6 +296,16 @@ test( "htmlClanup", function() { result = App.Utils.htmlClanup( $(source) ) equal( result.html(), should, source ) + source = "
some link to somewhere" + should = "
some link to somewhere
" + result = App.Utils.htmlClanup( $(source) ) + equal( result.html(), should, source ) + + source = "
" + should = "
some link to somewhere
" + result = App.Utils.htmlClanup( $(source) ) + equal( result.html(), should, source ) + source = "

some link to somewhere


" should = "
some link to somewhere

" result = App.Utils.htmlClanup( $(source) )