OLD | NEW |
1 package org.chromium.distiller.webdocument; | 1 package org.chromium.distiller.webdocument; |
2 | 2 |
3 import org.chromium.distiller.DomDistillerJsTestCase; | 3 import org.chromium.distiller.DomDistillerJsTestCase; |
4 | 4 |
5 public class WebTagTest extends DomDistillerJsTestCase { | 5 public class WebTagTest extends DomDistillerJsTestCase { |
6 | 6 |
7 public void testOLGenerateOutput() { | 7 public void testOLGenerateOutput() { |
8 WebTag olStartWebTag = new WebTag("ol", WebTag.TagType.START); | 8 WebTag olStartWebTag = new WebTag("ol", WebTag.TagType.START); |
9 WebTag olEndWebTag = new WebTag("ol", WebTag.TagType.END); | 9 WebTag olEndWebTag = new WebTag("ol", WebTag.TagType.END); |
10 String startResult = olStartWebTag.generateOutput(false); | 10 String startResult = olStartWebTag.generateOutput(false); |
11 String endResult = olEndWebTag.generateOutput(false); | 11 String endResult = olEndWebTag.generateOutput(false); |
12 assertEquals(startResult, "<ol>"); | 12 assertEquals(startResult, "<ol>"); |
13 assertEquals(endResult, "</ol>"); | 13 assertEquals(endResult, "</ol>"); |
14 } | 14 } |
15 | 15 |
16 public void testULGenerateOutput() { | 16 public void testGenerateOutput() { |
17 WebTag ulStartWebTag = new WebTag("ul", WebTag.TagType.START); | 17 WebTag startWebTag = new WebTag("anytext", WebTag.TagType.START); |
18 WebTag ulEndWebTag = new WebTag("ul", WebTag.TagType.END); | 18 WebTag endWebTag = new WebTag("anytext", WebTag.TagType.END); |
19 String startResult = ulStartWebTag.generateOutput(false); | 19 String startResult = startWebTag.generateOutput(false); |
20 String endResult = ulEndWebTag.generateOutput(false); | 20 String endResult = endWebTag.generateOutput(false); |
21 assertEquals(startResult, "<ul>"); | 21 assertEquals(startResult, "<anytext>"); |
22 assertEquals(endResult, "</ul>"); | 22 assertEquals(endResult, "</anytext>"); |
23 } | |
24 | |
25 public void testLIGenerateOutput() { | |
26 WebTag liStartWebTag = new WebTag("li", WebTag.TagType.START); | |
27 WebTag liEndWebTag = new WebTag("li", WebTag.TagType.END); | |
28 String startResult = liStartWebTag.generateOutput(false); | |
29 String endResult = liEndWebTag.generateOutput(false); | |
30 assertEquals(startResult, "<li>"); | |
31 assertEquals(endResult, "</li>"); | |
32 } | |
33 | |
34 public void testBlockquoteGenerateOutput() { | |
35 WebTag blockquoteStartWebTag = new WebTag("blockquote", | |
36 WebTag.TagType.START); | |
37 WebTag blockquoteEndWebTag = new WebTag("blockquote", | |
38 WebTag.TagType.END); | |
39 String startResult = blockquoteStartWebTag.generateOutput(false); | |
40 String endResult = blockquoteEndWebTag.generateOutput(false); | |
41 assertEquals(startResult, "<blockquote>"); | |
42 assertEquals(endResult, "</blockquote>"); | |
43 } | 23 } |
44 | 24 |
45 public void testCanBeNested() { | 25 public void testCanBeNested() { |
46 assertTrue(WebTag.canBeNested("LI")); | 26 assertTrue(WebTag.canBeNested("LI")); |
47 assertTrue(WebTag.canBeNested("UL")); | 27 assertTrue(WebTag.canBeNested("UL")); |
48 assertTrue(WebTag.canBeNested("OL")); | 28 assertTrue(WebTag.canBeNested("OL")); |
49 assertTrue(WebTag.canBeNested("BLOCKQUOTE")); | 29 assertTrue(WebTag.canBeNested("BLOCKQUOTE")); |
| 30 assertTrue(WebTag.canBeNested("PRE")); |
50 assertFalse(WebTag.canBeNested("SPAN")); | 31 assertFalse(WebTag.canBeNested("SPAN")); |
51 } | 32 } |
52 } | 33 } |
OLD | NEW |