| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| MiscWysiwygCleaningTest | 37 | 6 | 0% | 1 | 0 |
| 1 | /* | |
| 2 | * See the NOTICE file distributed with this work for additional | |
| 3 | * information regarding copyright ownership. | |
| 4 | * | |
| 5 | * This is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU Lesser General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2.1 of | |
| 8 | * the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This software is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this software; if not, write to the Free | |
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 19 | */ | |
| 20 | package org.xwiki.officeimporter.internal.cleaner; | |
| 21 | ||
| 22 | import java.io.StringReader; | |
| 23 | import java.util.Collections; | |
| 24 | ||
| 25 | import org.junit.Assert; | |
| 26 | import org.junit.Test; | |
| 27 | import org.w3c.dom.Document; | |
| 28 | import org.w3c.dom.NodeList; | |
| 29 | import org.xwiki.xml.html.HTMLCleanerConfiguration; | |
| 30 | ||
| 31 | /** | |
| 32 | * Miscellaneous cleaning tests for {@link WysiwygHTMLCleaner}. | |
| 33 | * | |
| 34 | * @version $Id: 6e0c44b16e4be8398595fa00718386478e0d3efe $ | |
| 35 | * @since 1.8 | |
| 36 | */ | |
| 37 | public class MiscWysiwygCleaningTest extends AbstractHTMLCleaningTest | |
| 38 | { | |
| 39 | /** | |
| 40 | * Test cleaning of HTML paragraphs with namespaces specified. | |
| 41 | */ | |
| 42 | 1 | @Test |
| 43 | public void testParagraphsWithNamespaces() | |
| 44 | { | |
| 45 | 1 | String html = header + "<w:p>paragraph</w:p>" + footer; |
| 46 | 1 | HTMLCleanerConfiguration configuration = this.officeHTMLCleaner.getDefaultConfiguration(); |
| 47 | 1 | configuration.setParameters(Collections.singletonMap(HTMLCleanerConfiguration.NAMESPACES_AWARE, "false")); |
| 48 | 1 | Document doc = wysiwygHTMLCleaner.clean(new StringReader(html), configuration); |
| 49 | 1 | NodeList nodes = doc.getElementsByTagName("p"); |
| 50 | 1 | Assert.assertEquals(1, nodes.getLength()); |
| 51 | } | |
| 52 | } |