1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.officeimporter.internal.cleaner; |
21 |
|
|
22 |
|
import java.io.StringReader; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Test; |
26 |
|
import org.w3c.dom.Document; |
27 |
|
import org.w3c.dom.NodeList; |
28 |
|
|
29 |
|
|
30 |
|
@link |
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
35 |
|
public class InvalidTagOfficeCleaningTest extends AbstractHTMLCleaningTest |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
40 |
1 |
@Test... |
41 |
|
public void testStyleTagRemoving() |
42 |
|
{ |
43 |
1 |
String html = |
44 |
|
"<html><head><title>Title</title>" + "<style type=\"text/css\">h1 {color:red} p {color:blue} </style>" |
45 |
|
+ "</head><body>" + footer; |
46 |
1 |
Document doc = officeHTMLCleaner.clean(new StringReader(html)); |
47 |
1 |
NodeList nodes = doc.getElementsByTagName("style"); |
48 |
1 |
Assert.assertEquals(0, nodes.getLength()); |
49 |
|
} |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
54 |
1 |
@Test... |
55 |
|
public void testScriptTagRemoving() |
56 |
|
{ |
57 |
1 |
String html = header + "<script type=\"text/javascript\">document.write(\"Hello World!\")</script>" + footer; |
58 |
1 |
Document doc = officeHTMLCleaner.clean(new StringReader(html)); |
59 |
1 |
NodeList nodes = doc.getElementsByTagName("script"); |
60 |
1 |
Assert.assertEquals(0, nodes.getLength()); |
61 |
|
} |
62 |
|
} |