use of com.github.bordertech.wcomponents.WHiddenComment in project wcomponents by BorderTech.
the class WHiddenCommentRenderer method doRender.
/**
* Paints the given WHiddenComment.
*
* @param component the WHiddenComment to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WHiddenComment hiddenComponent = (WHiddenComment) component;
XmlStringBuilder xml = renderContext.getWriter();
String hiddenText = hiddenComponent.getText();
if (!Util.empty(hiddenText)) {
xml.appendTag("ui:comment");
xml.appendEscaped(hiddenText);
xml.appendEndTag("ui:comment");
}
}
use of com.github.bordertech.wcomponents.WHiddenComment in project wcomponents by BorderTech.
the class WHiddenCommentRenderer_Test method testRendererCorrectlyConfigured.
/**
* Test the Layout is correctly configured.
*/
@Test
public void testRendererCorrectlyConfigured() {
WHiddenComment hiddenComment = new WHiddenComment("comment");
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(hiddenComment) instanceof WHiddenCommentRenderer);
}
use of com.github.bordertech.wcomponents.WHiddenComment in project wcomponents by BorderTech.
the class WHiddenCommentRenderer_Test method testEncodedComment.
@Test
public void testEncodedComment() throws IOException, SAXException, XpathException {
String textString = "test <br/> > <";
WHiddenComment comment = new WHiddenComment(textString);
// Validate
assertSchemaMatch(comment);
assertXpathEvaluatesTo(textString, COMMENT_XPATH, comment);
}
use of com.github.bordertech.wcomponents.WHiddenComment in project wcomponents by BorderTech.
the class WHiddenCommentRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WHiddenComment comment = new WHiddenComment(getMaliciousContent());
assertSafeContent(comment);
}
use of com.github.bordertech.wcomponents.WHiddenComment in project wcomponents by BorderTech.
the class WHiddenCommentRenderer_Test method testMultipleComments.
@Test
public void testMultipleComments() throws IOException, SAXException, XpathException {
String textString1 = "test comment1";
String textString2 = "test comment2";
WHiddenComment comment1 = new WHiddenComment(textString1);
WHiddenComment comment2 = new WHiddenComment(textString2);
WPanel panel = new WPanel();
panel.add(comment1);
panel.add(comment2);
// Validate
assertSchemaMatch(panel);
assertXpathEvaluatesTo("2", "count(//ui:comment)", panel);
}
Aggregations