diff options
Diffstat (limited to 'uitest')
2 files changed, 29 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusTest.java index ad9b600a32..742b55210a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusTest.java @@ -1,8 +1,12 @@ package com.vaadin.tests.components.checkboxgroup; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.junit.Assert; import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.CheckBoxGroupElement; @@ -27,4 +31,15 @@ public class CheckBoxGroupFocusTest extends FocusTest { assertTrue(isFocusInsideElement(checkBoxGroup)); } + @Test + public void focusDoesNotGoIntoWrapperElement() { + openTestURL(); + new Actions(getDriver()).sendKeys(Keys.TAB, Keys.TAB, Keys.TAB) + .perform(); + assertTrue("Focus not in the second check box group.", + isFocusInsideElement($(CheckBoxGroupElement.class).last())); + assertEquals("Focus should not be in the wrapping div.", "input", + getFocusedElement().getTagName()); + } + } diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusTest.java index ca5e3565d0..27970740d3 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusTest.java @@ -1,10 +1,15 @@ package com.vaadin.tests.components.radiobuttongroup; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.junit.Assert; import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.CheckBoxGroupElement; import com.vaadin.testbench.elements.RadioButtonGroupElement; import com.vaadin.tests.components.FocusTest; @@ -27,4 +32,13 @@ public class RadioButtonGroupFocusTest extends FocusTest { assertTrue(isFocusInsideElement(radioButtonGroup2)); } + @Test + public void focusDoesNotGoIntoWrapperElement() { + openTestURL(); + new Actions(getDriver()).sendKeys(Keys.TAB).perform(); + assertTrue("Focus not in the second radio button group.", + isFocusInsideElement($(RadioButtonGroupElement.class).last())); + assertEquals("Focus should not be in the wrapping div.", "input", + getFocusedElement().getTagName()); + } } |