use of com.github.bordertech.wcomponents.WCheckBoxSelect in project wcomponents by BorderTech.
the class WCheckBoxSelectRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WCheckBoxSelect wcb = new WCheckBoxSelect(Arrays.asList(new Object[] { getInvalidCharSequence(), getMaliciousContent() }));
assertSafeContent(wcb);
wcb.setToolTip(getMaliciousAttribute("ui:checkboxselect"));
assertSafeContent(wcb);
wcb.setAccessibleText(getMaliciousAttribute("ui:checkboxselect"));
assertSafeContent(wcb);
}
use of com.github.bordertech.wcomponents.WCheckBoxSelect in project wcomponents by BorderTech.
the class WCheckBoxSelectRenderer_Test method testDoPaintReadOnly.
@Test
public void testDoPaintReadOnly() throws IOException, SAXException, XpathException {
WCheckBoxSelect wcbTest = new WCheckBoxSelect(new String[] { "a", "b", "c" });
assertSchemaMatch(wcbTest);
setActiveContext(createUIContext());
// Check Readonly - only render selected option
wcbTest.setReadOnly(true);
wcbTest.setSelected(Arrays.asList(new String[] { "b" }));
assertSchemaMatch(wcbTest);
assertXpathEvaluatesTo("true", "//ui:checkboxselect/@readOnly", wcbTest);
assertXpathEvaluatesTo("1", "count(//ui:checkboxselect/ui:option)", wcbTest);
assertXpathEvaluatesTo("1", "count(//ui:checkboxselect/ui:option[@selected='true'])", wcbTest);
assertXpathEvaluatesTo("b", "//ui:checkboxselect/ui:option[@selected='true']", wcbTest);
}
use of com.github.bordertech.wcomponents.WCheckBoxSelect in project wcomponents by BorderTech.
the class WCheckBoxSelectRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WCheckBoxSelect wcbTest = new WCheckBoxSelect(new String[] { "a", "b", "c" });
assertSchemaMatch(wcbTest);
assertXpathEvaluatesTo("3", "count(//ui:checkboxselect/ui:option)", wcbTest);
// Check selected
assertXpathNotExists("//ui:checkboxselect/ui:option[@selected='true']", wcbTest);
setActiveContext(createUIContext());
wcbTest.setSelected(Arrays.asList(new String[] { "b" }));
assertSchemaMatch(wcbTest);
assertXpathEvaluatesTo("1", "count(//ui:checkboxselect/ui:option[@selected='true'])", wcbTest);
assertXpathEvaluatesTo("b", "//ui:checkboxselect/ui:option[@selected='true']", wcbTest);
// Check Readonly - only render selected option
wcbTest.setReadOnly(true);
assertSchemaMatch(wcbTest);
assertXpathEvaluatesTo("true", "//ui:checkboxselect/@readOnly", wcbTest);
assertXpathEvaluatesTo("1", "count(//ui:checkboxselect/ui:option)", wcbTest);
assertXpathEvaluatesTo("1", "count(//ui:checkboxselect/ui:option[@selected='true'])", wcbTest);
assertXpathEvaluatesTo("b", "//ui:checkboxselect/ui:option[@selected='true']", wcbTest);
}
Aggregations