use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WListRenderer_Test method testRenderedFormatEmptyWithBorder.
@Test
public void testRenderedFormatEmptyWithBorder() throws IOException, SAXException, XpathException {
// empty list, with border
WList list = new WList(WList.Type.STRIPED);
list.setRenderBorder(true);
list.setRepeatedComponent(new WText());
assertSchemaMatch(list);
assertXpathEvaluatesTo("striped", "//ui:listlayout/@type", list);
assertXpathEvaluatesTo("box", "//ui:panel/@type", list);
assertXpathNotExists("//ui:listlayout/@separator", list);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WPanelRenderer_Test method testRenderedLazyModePanel.
@Test
public void testRenderedLazyModePanel() throws IOException, SAXException, XpathException {
String content = "TEST CONTENT";
WPanel panel = new WPanel();
panel.setMode(PanelMode.LAZY);
panel.add(new WText(content));
// Content NOT Hidden
assertSchemaMatch(panel);
// If not hidden, then the panel's content should be rendered
assertXpathEvaluatesTo("", "//ui:panel/@type", panel);
assertXpathEvaluatesTo("", "//ui:panel/@hidden", panel);
assertXpathEvaluatesTo("lazy", "//ui:panel/@mode", panel);
assertXpathEvaluatesTo(content, "//ui:panel/ui:content", panel);
// Content Hidden
// Create User Context with UI component
UIContext uic = createUIContext();
uic.setUI(new DefaultWComponent());
setActiveContext(uic);
setFlag(panel, ComponentModel.HIDE_FLAG, true);
assertSchemaMatch(panel);
// If hidden, then the panel's content should NOT be rendered
assertXpathEvaluatesTo("", "//ui:panel/@type", panel);
assertXpathEvaluatesTo("true", "//ui:panel/@hidden", panel);
assertXpathEvaluatesTo("lazy", "//ui:panel/@mode", panel);
assertXpathEvaluatesTo("", "//ui:panel/ui:content", panel);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WSectionRenderer_Test method testRenderedLazyMode.
@Test
public void testRenderedLazyMode() throws IOException, SAXException, XpathException {
WSection section = new WSection(SECTION_HEADING);
section.setMode(SectionMode.LAZY);
section.getContent().add(new WText(SECTION_CONTENT));
// Content NOT Hidden
assertSchemaMatch(section);
// If not hidden, then the section's content should be rendered
assertXpathEvaluatesTo("", "//ui:section/@type", section);
assertXpathEvaluatesTo("", "//ui:section/@hidden", section);
assertXpathEvaluatesTo("lazy", "//ui:section/@mode", section);
assertXpathEvaluatesTo(SECTION_CONTENT, "normalize-space(//ui:section/ui:panel)", section);
// Content Hidden
// Create User Context with UI component
UIContext uic = createUIContext();
uic.setUI(new DefaultWComponent());
setActiveContext(uic);
setFlag(section, ComponentModel.HIDE_FLAG, true);
assertSchemaMatch(section);
// If hidden, then the section's content should NOT be rendered
assertXpathEvaluatesTo("", "//ui:section/@type", section);
assertXpathEvaluatesTo("true", "//ui:section/@hidden", section);
assertXpathEvaluatesTo("lazy", "//ui:section/@mode", section);
assertXpathEvaluatesTo("", "normalize-space(//ui:section/ui:panel)", section);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WSectionRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WSection section = new WSection(getMaliciousContent());
section.getContent().add(new WText(getMaliciousContent()));
assertSafeContent(section);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WTabGroupRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WTabGroup tabGroup = new WTabGroup(getMaliciousContent());
tabGroup.addTab(new WText("dummy"), "dummy", TabMode.CLIENT);
WComponent wrapped = wrapTabGroup(tabGroup);
assertSafeContent(wrapped);
tabGroup.setToolTip(getMaliciousAttribute("ui:tab"));
assertSafeContent(wrapped);
tabGroup.setAccessibleText(getMaliciousAttribute("ui:tab"));
assertSafeContent(wrapped);
}
Aggregations