Search in sources :

Example 6 with RadioButtonGroup

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());
}
Also used : RadioButtonGroup(com.github.bordertech.wcomponents.RadioButtonGroup) Test(org.junit.Test)

Example 7 with RadioButtonGroup

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);
}
Also used : RadioButtonGroup(com.github.bordertech.wcomponents.RadioButtonGroup) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 8 with RadioButtonGroup

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);
}
Also used : WRadioButton(com.github.bordertech.wcomponents.WRadioButton) RadioButtonGroup(com.github.bordertech.wcomponents.RadioButtonGroup) Test(org.junit.Test)

Example 9 with RadioButtonGroup

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);
}
Also used : WRadioButton(com.github.bordertech.wcomponents.WRadioButton) RadioButtonGroup(com.github.bordertech.wcomponents.RadioButtonGroup) Test(org.junit.Test)

Example 10 with RadioButtonGroup

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);
}
Also used : WRadioButton(com.github.bordertech.wcomponents.WRadioButton) RadioButtonGroup(com.github.bordertech.wcomponents.RadioButtonGroup) Test(org.junit.Test)

Aggregations

RadioButtonGroup (com.github.bordertech.wcomponents.RadioButtonGroup)11 WRadioButton (com.github.bordertech.wcomponents.WRadioButton)9 Test (org.junit.Test)8 WLabel (com.github.bordertech.wcomponents.WLabel)3 WDateField (com.github.bordertech.wcomponents.WDateField)2 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)2 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)2 WNumberField (com.github.bordertech.wcomponents.WNumberField)2 WTextField (com.github.bordertech.wcomponents.WTextField)2 AbstractWSelectList (com.github.bordertech.wcomponents.AbstractWSelectList)1 Margin (com.github.bordertech.wcomponents.Margin)1 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)1 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)1 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)1 WContainer (com.github.bordertech.wcomponents.WContainer)1 WDropdown (com.github.bordertech.wcomponents.WDropdown)1 WEmailField (com.github.bordertech.wcomponents.WEmailField)1 WHeading (com.github.bordertech.wcomponents.WHeading)1 WImage (com.github.bordertech.wcomponents.WImage)1 WMultiSelect (com.github.bordertech.wcomponents.WMultiSelect)1