From 91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05 Mon Sep 17 00:00:00 2001 From: Dan Weinand Date: Thu, 30 Oct 2008 12:52:12 -0500 Subject: Using the highlight helper on text with html shouldn't highlight text inside html attributes. [#1302 state:resolved] Signed-off-by: Pratik Naik --- actionpack/test/template/text_helper_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 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 a6200fbdd7..564845779f 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -122,6 +122,29 @@ class TextHelperTest < ActionView::TestCase ) end + def test_highlight_with_html + assert_equal( + "

This is a beautiful morning, but also a beautiful day

", + highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") + ) + assert_equal( + "

This is a beautiful morning, but also a beautiful day

", + highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") + ) + assert_equal( + "

This is a beautiful morning, but also a beautiful day

", + highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") + ) + assert_equal( + "

This is a beautiful morning, but also a beautiful day

", + highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") + ) + assert_equal( + "

This is a beautiful morning, but also a beautiful day

", + highlight("

This is a beautiful morning, but also a beautiful day

", "beautiful") + ) + end + def test_excerpt assert_equal("...is a beautiful morn...", 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