Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XWiki
xwiki-commons
Commits
c67e7100
Commit
c67e7100
authored
Jan 17, 2022
by
Michael Hamann
Browse files
XCOMMONS-901: Support both XHTML 1.0 and XHTML 5 in HtmlCleaner
* Fix test to consider no-longer deprecated elements.
parent
3dfab5bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
xwiki-commons-core/xwiki-commons-xml/src/test/java/org/xwiki/xml/internal/html/HTML5HTMLCleanerTest.java
View file @
c67e7100
...
...
@@ -67,6 +67,29 @@ void setUpCleaner()
this
.
cleanerConfiguration
.
setParameters
(
parameters
);
}
/**
* In HTML5, some elements that were deprecated/removed in XHTML 1.0 are not deprecated anymore. This overrides
* the test to ensure they are not removed.
*/
@Override
@Test
void
conversionsFromHTML
()
{
assertHTML
(
"<p>this <b>is</b> highlighted but not important</p>"
,
"this <b>is</b> highlighted but not important"
);
assertHTML
(
"<p><i>alternate voice</i></p>"
,
"<i>alternate voice</i>"
);
assertHTML
(
"<del>strike</del>"
,
"<strike>strike</strike>"
);
assertHTML
(
"<p><s>no longer relevant</s></p>"
,
"<s>no longer relevant</s>"
);
assertHTML
(
"<p><u>misspell</u></p>"
,
"<u>misspell</u>"
);
assertHTML
(
"<p style=\"text-align:center\">center</p>"
,
"<center>center</center>"
);
assertHTML
(
"<p><span style=\"color:red;font-family:Arial;font-size:1.0em;\">This is some text!</span></p>"
,
"<font face=\"Arial\" size=\"3\" color=\"red\">This is some text!</font>"
);
assertHTML
(
"<p><span style=\"font-size:1.6em;\">This is some text!</span></p>"
,
"<font size=\"+3\">This is some text!</font>"
);
assertHTML
(
"<table><tbody><tr><td style=\"text-align:right;background-color:red;vertical-align:top\">"
+
"x</td></tr></tbody></table>"
,
"<table><tr><td align=right valign=top bgcolor=red>x</td></tr></table>"
);
}
/**
* This tests various invalid list usages. With HTML5, the lists are cleaned by HTMLCleaner sometimes and thus the
* list-style-type is not set to none as in the custom filter in XWiki. Further, HTML comments are not moved
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment