use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class GroupExpression_Test method testBuildNot.
@Test
public void testBuildNot() {
GroupExpression expr = new GroupExpression(GroupExpression.Type.NOT);
BooleanExpression operand1 = new CompareExpression(CompareType.EQUAL, new WTextField(), "1");
expr.add(operand1);
Not condition = (Not) expr.build();
Assert.assertEquals("Incorrect 1st operand for NOT", operand1.build().toString(), condition.getCondition().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testWhenTrue.
@Test
public void testWhenTrue() {
SubordinateBuilder builder = new SubordinateBuilder();
WTextField comp1 = new WTextField();
WTextField comp2 = new WTextField();
builder.condition().equals(comp1, "x");
builder.whenTrue().disable(comp1);
builder.whenFalse().enable(comp2);
setActiveContext(createUIContext());
Assert.assertFalse("comp1 should not be disabled until rule executes", comp1.isDisabled());
Assert.assertFalse("comp2 should not be disabled", comp2.isDisabled());
comp1.setText("x");
builder.build().applyTheControls();
Assert.assertTrue("comp1 should be disabled", comp1.isDisabled());
Assert.assertFalse("comp2 should not be disabled", comp2.isDisabled());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testMissingActions.
@Test(expected = SystemException.class)
public void testMissingActions() {
SubordinateBuilder builder = new SubordinateBuilder();
builder.condition().equals(new WTextField(), "x");
builder.build();
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testWhenFalse.
@Test
public void testWhenFalse() {
SubordinateBuilder builder = new SubordinateBuilder();
WTextField comp1 = new WTextField();
WTextField comp2 = new WTextField();
builder.condition().equals(comp1, "x");
builder.whenFalse().disable(comp1);
builder.whenTrue().enable(comp2);
Assert.assertFalse("comp1 should not be disabled until rule executes", comp1.isDisabled());
Assert.assertFalse("comp2 should not be disabled", comp2.isDisabled());
setActiveContext(createUIContext());
comp1.setText("y");
builder.build().applyTheControls();
Assert.assertTrue("comp1 should be disabled", comp1.isDisabled());
Assert.assertFalse("comp2 should not be disabled", comp2.isDisabled());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class HtmlRenderUtilTest method testGetEffectivePlaceholderWithExplicitValue.
@Test
public void testGetEffectivePlaceholderWithExplicitValue() {
Placeholderable field = new WTextField();
String expected = "my placeholder is boring";
field.setPlaceholder(expected);
String actual = HtmlRenderUtil.getEffectivePlaceholder(field);
Assert.assertEquals(expected, actual);
}
Aggregations