Search in sources :

Example 36 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testNotWithAndCondition.

/**
 * Test Not with And condition.
 */
@Test
public void testNotWithAndCondition() {
    builder.equals(new WTextField(), "1").and().not(new ExpressionBuilder().equals(new WTextArea(), "2")).or().not(new ExpressionBuilder().equals(new WTextArea(), "2")).and().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and NOT (WTextArea=\"2\")) or (NOT (WTextArea=\"2\") and WDropdown=\"3\"))", builder.build().toString());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 37 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testThreeArgAndCondition.

@Test
public void testThreeArgAndCondition() {
    builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").and().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and WTextArea=\"2\" and WDropdown=\"3\")", builder.build().toString());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 38 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class GroupExpression_Test method testBuildAnd.

@Test
public void testBuildAnd() {
    GroupExpression expr = new GroupExpression(GroupExpression.Type.AND);
    BooleanExpression operand1 = new CompareExpression(CompareType.EQUAL, new WTextField(), "1");
    BooleanExpression operand2 = new CompareExpression(CompareType.EQUAL, new WTextField(), "2");
    BooleanExpression operand3 = new CompareExpression(CompareType.EQUAL, new WTextField(), "3");
    expr.add(operand1);
    expr.add(operand2);
    expr.add(operand3);
    And condition = (And) expr.build();
    Assert.assertEquals("Incorrect number of conditions for AND", 3, condition.getConditions().size());
    Assert.assertEquals("Incorrect 1st operand for AND", operand1.build().toString(), condition.getConditions().get(0).toString());
    Assert.assertEquals("Incorrect 2nd operand for AND", operand2.build().toString(), condition.getConditions().get(1).toString());
    Assert.assertEquals("Incorrect 3rd operand for AND", operand3.build().toString(), condition.getConditions().get(2).toString());
}
Also used : And(com.github.bordertech.wcomponents.subordinate.And) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 39 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class HtmlRenderUtilTest method testGetEffectivePlaceholder.

@Test
public void testGetEffectivePlaceholder() {
    Placeholderable field = new WTextField();
    String actual = HtmlRenderUtil.getEffectivePlaceholder(field);
    Assert.assertNull("Placeholder should not be set for an optional field with no explicit placeholder text", actual);
}
Also used : WTextField(com.github.bordertech.wcomponents.WTextField) Placeholderable(com.github.bordertech.wcomponents.Placeholderable) Test(org.junit.Test)

Example 40 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class AbstractContainerHelper_Test method testGetUI.

@Test
public void testGetUI() {
    AbstractContainerHelper helper = new MyContainerHelper();
    WebComponent webComponent = new WTextField();
    helper.setWebComponent(webComponent);
    Assert.assertSame("getUI returned incorrect UI", webComponent, helper.getUI());
}
Also used : WebComponent(com.github.bordertech.wcomponents.WebComponent) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Aggregations

WTextField (com.github.bordertech.wcomponents.WTextField)117 Test (org.junit.Test)90 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)21 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)21 WContainer (com.github.bordertech.wcomponents.WContainer)21 Equal (com.github.bordertech.wcomponents.subordinate.Equal)16 GreaterThanOrEqual (com.github.bordertech.wcomponents.subordinate.GreaterThanOrEqual)15 LessThanOrEqual (com.github.bordertech.wcomponents.subordinate.LessThanOrEqual)15 NotEqual (com.github.bordertech.wcomponents.subordinate.NotEqual)15 Rule (com.github.bordertech.wcomponents.subordinate.Rule)15 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)15 SubordinateTrigger (com.github.bordertech.wcomponents.SubordinateTrigger)14 WTextArea (com.github.bordertech.wcomponents.WTextArea)14 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)12 WDropdown (com.github.bordertech.wcomponents.WDropdown)12 WButton (com.github.bordertech.wcomponents.WButton)11 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)11 WHeading (com.github.bordertech.wcomponents.WHeading)10 WLabel (com.github.bordertech.wcomponents.WLabel)10 Hide (com.github.bordertech.wcomponents.subordinate.Hide)10