Search in sources :

Example 6 with WDropdown

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

the class WDropdownSpecialCharHandlingExample_Test method testExample.

@Test
public void testExample() {
    WDropdownSpecialCharHandlingExample example = (WDropdownSpecialCharHandlingExample) getUi();
    // Launch the web browser to the LDE
    SeleniumWComponentsWebDriver driver = getDriver();
    UIContext uic = getUserContextForSession();
    UIContextHolder.pushContext(uic);
    try {
        WDropdown dropdown = (WDropdown) TreeUtil.findWComponent(example, new String[] { "WDropdown" }).getComponent();
        List<?> options = dropdown.getOptions();
        for (Object option : options) {
            driver.findElement(byWComponent(dropdown, option)).click();
            driver.findElement(byWComponentPath("WButton")).click();
            Assert.assertEquals("Incorrect option selected", option, dropdown.getSelected());
            Assert.assertEquals("Incorrect text field text", (option == null ? "" : option), driver.findWTextField(byWComponentPath("WTextField")).getValue());
        }
    } finally {
        UIContextHolder.popContext();
    }
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) WDropdown(com.github.bordertech.wcomponents.WDropdown) UIContext(com.github.bordertech.wcomponents.UIContext) Test(org.junit.Test)

Example 7 with WDropdown

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

the class ExpressionBuilder_Test method testAndOperatorPrecedenceRHS.

/**
 * Tests for correct operator precedence when there is an AND on the right-hand side of the OR: a || b
 * {@literal &}{@literal &} c.
 */
@Test
public void testAndOperatorPrecedenceRHS() {
    builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2").and().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or (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 8 with WDropdown

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

the class ExpressionBuilder_Test method testAndOperatorPrecedenceLHS.

/**
 * Tests for correct operator precedence when there is an AND on the left-hand side of the OR: a
 * {@literal &}{@literal &} b || c.
 */
@Test
public void testAndOperatorPrecedenceLHS() {
    builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and WTextArea=\"2\") or 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 9 with WDropdown

use of com.github.bordertech.wcomponents.WDropdown 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 10 with WDropdown

use of com.github.bordertech.wcomponents.WDropdown 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)

Aggregations

WDropdown (com.github.bordertech.wcomponents.WDropdown)33 Test (org.junit.Test)28 WTextField (com.github.bordertech.wcomponents.WTextField)12 WTextArea (com.github.bordertech.wcomponents.WTextArea)10 UIContext (com.github.bordertech.wcomponents.UIContext)7 WMultiSelect (com.github.bordertech.wcomponents.WMultiSelect)6 SeleniumWComponentsWebDriver (com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver)6 OptionGroup (com.github.bordertech.wcomponents.OptionGroup)3 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)3 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)2 WComponent (com.github.bordertech.wcomponents.WComponent)2 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)2 Equal (com.github.bordertech.wcomponents.subordinate.Equal)2 Hide (com.github.bordertech.wcomponents.subordinate.Hide)2 Rule (com.github.bordertech.wcomponents.subordinate.Rule)2 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)2 Action (com.github.bordertech.wcomponents.Action)1 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)1 RadioButtonGroup (com.github.bordertech.wcomponents.RadioButtonGroup)1 TestLookupTable (com.github.bordertech.wcomponents.TestLookupTable)1