use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class WPanelRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
WPanel panel = new WPanel();
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(panel) instanceof WPanelRenderer);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class WFieldErrorIndicatorRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WContainer root = new WContainer();
WPanel target = new WPanel();
WFieldErrorIndicator indicator = new WFieldErrorIndicator(target);
root.add(target);
root.add(indicator);
// Simulate Error Message
setActiveContext(createUIContext());
List<Diagnostic> diags = new ArrayList<>();
diags.add(new DiagnosticImpl(Diagnostic.ERROR, target, "Test Error"));
root.showErrorIndicators(diags);
// Validate Schema
assertSchemaMatch(root);
// Check Attributes
assertXpathEvaluatesTo(indicator.getId(), "//ui:fieldindicator/@id", root);
assertXpathEvaluatesTo("error", "//ui:fieldindicator/@type", root);
assertXpathEvaluatesTo(target.getId(), "//ui:fieldindicator/@for", root);
// Check Message
assertXpathEvaluatesTo("Test Error", "//ui:fieldindicator/ui:message", root);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class WFieldWarningIndicatorRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WContainer root = new WContainer();
WPanel target = new WPanel();
WFieldWarningIndicator indicator = new WFieldWarningIndicator(target);
root.add(target);
root.add(indicator);
setActiveContext(createUIContext());
List<Diagnostic> diags = new ArrayList<>();
diags.add(new DiagnosticImpl(Diagnostic.WARNING, target, getMaliciousContent()));
root.showWarningIndicators(diags);
assertSafeContent(root);
}
use of com.github.bordertech.wcomponents.WPanel 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);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class BorderLayoutRenderer_Test method testDoRenderWhenEmpty.
@Test
public void testDoRenderWhenEmpty() throws IOException, SAXException, XpathException {
WPanel container = new WPanel();
container.setLayout(new BorderLayout());
assertSchemaMatch(container);
assertXpathExists("//ui:panel/ui:borderlayout", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/@hgap", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/@vgap", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/ui:north", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/ui:south", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/ui:east", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/ui:west", container);
assertXpathNotExists("//ui:panel/ui:borderlayout/ui:center", container);
}
Aggregations