use of com.github.bordertech.wcomponents.RadioButtonGroup in project wcomponents by BorderTech.
the class AbstractCompare_Test method testGetCompareValueRadioButtonGroup.
@Test
public void testGetCompareValueRadioButtonGroup() {
RadioButtonGroup trigger = new RadioButtonGroup();
// Null Value
AbstractCompare compare = new MyCompare(trigger, null);
Assert.assertNull("RadioButtonGroup Compare Value - should be null for null value", compare.getCompareValue());
// Empty Value
compare = new MyCompare(trigger, "");
Assert.assertNull("RadioButtonGroup Compare Value - should be null for empty value", compare.getCompareValue());
// Value
compare = new MyCompare(trigger, Boolean.FALSE);
Assert.assertEquals("RadioButtonGroup Compare Value - should be the string of the value", Boolean.FALSE.toString(), compare.getCompareValue());
// Button - Null Value
compare = new MyCompare(trigger, trigger.addRadioButton(null));
Assert.assertNull("RadioButtonGroup Compare Value - should be null for button with null value", compare.getCompareValue());
// Button - Empty Value
compare = new MyCompare(trigger, trigger.addRadioButton(""));
Assert.assertNull("RadioButtonGroup Compare Value - should be null for button with empty value", compare.getCompareValue());
// Button - Value
compare = new MyCompare(trigger, trigger.addRadioButton("B1"));
Assert.assertEquals("RadioButtonGroup Compare Value - should be the string of the value", "B1", compare.getCompareValue());
}
use of com.github.bordertech.wcomponents.RadioButtonGroup in project wcomponents by BorderTech.
the class WLabelRenderer_Test method testWhatForGroup6.
@Test
public void testWhatForGroup6() throws IOException, SAXException, XpathException {
RadioButtonGroup comp = new RadioButtonGroup();
WLabel label = new WLabel("label", comp);
assertSchemaMatch(label);
assertXpathEvaluatesTo("group", "//ui:label/@what", label);
}
use of com.github.bordertech.wcomponents.RadioButtonGroup in project wcomponents by BorderTech.
the class WRadioButtonRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
RadioButtonGroup group = new RadioButtonGroup();
WRadioButton component = group.addRadioButton(1);
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(component) instanceof WRadioButtonRenderer);
}
use of com.github.bordertech.wcomponents.RadioButtonGroup in project wcomponents by BorderTech.
the class WRadioButtonRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
RadioButtonGroup group = new RadioButtonGroup();
WRadioButton button = group.addRadioButton(1);
assertSafeContent(button);
button.setToolTip(getMaliciousAttribute());
assertSafeContent(button);
button.setAccessibleText(getMaliciousAttribute());
assertSafeContent(button);
}
use of com.github.bordertech.wcomponents.RadioButtonGroup in project wcomponents by BorderTech.
the class WRadioButtonRenderer_Test method testReadOnly.
@Test
public void testReadOnly() throws IOException, SAXException, XpathException {
RadioButtonGroup group = new RadioButtonGroup();
WRadioButton button = group.addRadioButton(1);
button.setVisible(true);
// Check readOnly
assertXpathNotExists("//ui:radiobutton/@readOnly", button);
button.setReadOnly(true);
assertSchemaMatch(button);
assertXpathEvaluatesTo("true", "//ui:radiobutton/@readOnly", button);
// Check selected read-only
assertXpathNotExists("//ui:radiobutton/@selected", button);
button.setSelected(true);
assertSchemaMatch(button);
assertXpathEvaluatesTo("true", "//ui:radiobutton/@selected", button);
}
Aggregations