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
c78db2bc
Unverified
Commit
c78db2bc
authored
Jan 13, 2022
by
Thomas Mortagne
Committed by
GitHub
Jan 13, 2022
Browse files
Merge pull request #158 from michitux/fix-XCOMMONS-901
parents
4f7730b3
805eb193
Changes
2
Hide whitespace changes
Inline
Side-by-side
xwiki-commons-core/xwiki-commons-xml/src/test/java/org/xwiki/xml/internal/html/DefaultHTMLCleanerTest.java
View file @
c78db2bc
...
...
@@ -81,7 +81,7 @@
private
static
final
String
HEADER_FULL
=
HEADER
+
"<html><head></head><body>"
;
pr
ivate
static
final
String
FOOTER
=
"</body></html>\n"
;
pr
otected
static
final
String
FOOTER
=
"</body></html>\n"
;
@InjectMockComponents
protected
DefaultHTMLCleaner
cleaner
;
...
...
@@ -601,7 +601,7 @@ protected void assertHTML(String expected, String actual)
assertEquals
(
getHeaderFull
()
+
expected
+
FOOTER
,
HTMLUtils
.
toString
(
documentValue
));
}
pr
ivate
void
assertHTMLWithHeadContent
(
String
expected
,
String
actual
)
pr
otected
void
assertHTMLWithHeadContent
(
String
expected
,
String
actual
)
{
assertEquals
(
getHeader
()
+
"<html><head>"
+
expected
+
"</head><body>"
+
FOOTER
,
HTMLUtils
.
toString
(
clean
(
actual
)));
...
...
xwiki-commons-core/xwiki-commons-xml/src/test/java/org/xwiki/xml/internal/html/HTML5HTMLCleanerTest.java
View file @
c78db2bc
...
...
@@ -67,21 +67,44 @@ void setUpCleaner()
this
.
cleanerConfiguration
.
setParameters
(
parameters
);
}
/**
* Disable SVG test until https://sourceforge.net/p/htmlcleaner/bugs/228/ is fixed.
*
* This test should be removed again once it has been fixed to re-enable the parent test.
*/
@Test
@Override
@Disabled
(
"See https://sourceforge.net/p/htmlcleaner/bugs/228/"
)
void
cleanSVGTags
()
throws
Exception
{
super
.
cleanSVGTags
();
String
input
=
"<p>before</p>\n"
+
"<p><svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n"
+
"<circle cx=\"100\" cy=\"50\" fill=\"red\" r=\"40\" stroke=\"black\" stroke-width=\"2\"></circle>\n"
+
"</svg></p>\n"
+
"<p>after</p>\n"
;
assertHTML
(
input
,
getHeaderFull
()
+
input
+
FOOTER
);
}
/**
* Disable style test until https://sourceforge.net/p/htmlcleaner/bugs/229/ is fixed.
*
* This test should be removed again once it has been fixed to re-enable the parent test.
*/
@Test
@Override
@Disabled
(
"See https://sourceforge.net/p/htmlcleaner/bugs/229/"
)
void
styleAndCData
()
{
super
.
styleAndCData
();
assertHTMLWithHeadContent
(
"<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>"
,
"<style type=\"text/css\"><![CDATA[\na { color: red; }\n]]></style>"
);
assertHTMLWithHeadContent
(
"<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>"
,
"<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>"
);
assertHTMLWithHeadContent
(
"<style type=\"text/css\">/*<![CDATA[*/\na>span { color: blue;}\n/*]]>*/</style>"
,
"<style type=\"text/css\">a>span { color: blue;}</style>"
);
assertHTMLWithHeadContent
(
"<style>/*<![CDATA[*/\n<>\n/*]]>*/</style>"
,
"<style><></style>"
);
assertHTMLWithHeadContent
(
"<style>/*<![CDATA[*/\n<>\n/*]]>*/</style>"
,
"<style><></style>"
);
}
/**
...
...
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