diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-06-20 15:27:54 +0300 |
---|---|---|
committer | Zhe Sun <31067185+ZheSun88@users.noreply.github.com> | 2019-06-20 15:27:54 +0300 |
commit | 0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15 (patch) | |
tree | 2bba996860a2df8de1d1eb96f1b2302f697bd5a5 /uitest | |
parent | 35c27717e954a1bcaafb64e103ed651ba4a82581 (diff) | |
download | vaadin-framework-0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15.tar.gz vaadin-framework-0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15.zip |
Add IE11 workaround for ListSelect multiselection. (#11631)
Fixes #11608
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectMultiSelectionTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectMultiSelectionTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectMultiSelectionTest.java new file mode 100644 index 0000000000..a5b2c6394c --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectMultiSelectionTest.java @@ -0,0 +1,56 @@ +package com.vaadin.tests.components.listselect; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.Select; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ListSelectElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ListSelectMultiSelectionTest extends MultiBrowserTest { + + @Override + protected Class<?> getUIClass() { + return ListSelectTestUI.class; + } + + @Test + public void testShiftSelect() { + openTestURL(); + + ListSelectElement listSelect = $(ListSelectElement.class).first(); + Select select = new Select(listSelect.getSelectElement()); + List<WebElement> options = listSelect + .findElements(By.tagName("option")); + options.get(0).click(); + + List<WebElement> selected = select.getAllSelectedOptions(); + assertEquals(1, selected.size()); + assertEquals("Item 0", selected.get(0).getText()); + + new Actions(getDriver()).keyDown(Keys.SHIFT).perform(); + options.get(1).click(); + new Actions(getDriver()).keyUp(Keys.SHIFT).perform(); + + selected = select.getAllSelectedOptions(); + assertEquals(2, selected.size()); + assertEquals("Item 1", selected.get(1).getText()); + + new Actions(getDriver()).keyDown(Keys.SHIFT).perform(); + options.get(2).click(); + new Actions(getDriver()).keyUp(Keys.SHIFT).perform(); + + // ensure second shift selection added instead of moved + selected = select.getAllSelectedOptions(); + assertEquals(3, selected.size()); + assertEquals("Item 2", selected.get(2).getText()); + assertEquals("Item 0", selected.get(0).getText()); + } +} |