From 67d5a1abedaae4c2ccc5057bb6780708f04b5f10 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 30 Mar 2007 01:19:01 +0000 Subject: Highlight helper highlights one or many terms in a single pass. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6493 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/text_helper_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 2f11547db5..61afbb5136 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -65,6 +65,8 @@ class TextHelperTest < Test::Unit::TestCase "This text is not changed because we supplied an empty phrase", highlight("This text is not changed because we supplied an empty phrase", nil) ) + + assert_equal ' ', highlight(' ', 'blank text is returned verbatim') end def test_highlighter_with_regexp @@ -84,6 +86,10 @@ class TextHelperTest < Test::Unit::TestCase ) end + def test_highlighting_multiple_phrases_in_one_pass + assert_equal %(wow em), highlight('wow em', %w(wow em), '\1') + end + def test_excerpt assert_equal("...is a beautiful morni...", excerpt("This is a beautiful morning", "beautiful", 5)) assert_equal("This is a...", excerpt("This is a beautiful morning", "this", 5)) -- cgit v1.2.3