1 package info.magnolia.cms.taglibs.util; 2 3 import junit.framework.TestCase; 4 5 6 10 public class SearchResultSnippetTagTest extends TestCase { 11 12 public void testStripHtmlSimple() { 13 String html = "<div>uh!</div>"; 14 String text = "uh!"; 15 String result = new SearchResultSnippetTag().stripHtmlTags(html); 16 assertEquals(text, result); 17 } 18 19 public void testStripHtmlEmptyTag() { 20 String html = "<div>uh!<br/></div>"; 21 String text = "uh!"; 22 String result = new SearchResultSnippetTag().stripHtmlTags(html); 23 assertEquals(text, result); 24 } 25 26 public void testStripHtmlNewLines() { 27 String html = "<div\n class=\"abc\">uh!</div>"; 28 String text = "uh!"; 29 String result = new SearchResultSnippetTag().stripHtmlTags(html); 30 assertEquals(text, result); 31 } 32 33 public void testStripHtmlMultipleNewLines() { 34 String html = "<div\n class=\"abc\"\n style=\"abc\">uh!</div>"; 35 String text = "uh!"; 36 String result = new SearchResultSnippetTag().stripHtmlTags(html); 37 assertEquals(text, result); 38 } 39 40 public void testStripHtmlNewLineAsLast() { 41 String html = "<div\n class=\"abc\"\n style=\"abc\"\n>uh!</div>"; 42 String text = "uh!"; 43 String result = new SearchResultSnippetTag().stripHtmlTags(html); 44 assertEquals(text, result); 45 } 46 } 47 | Popular Tags |