diff options
author | Guillermo Alvarez <guillermo@vaadin.com> | 2014-08-06 17:25:09 +0300 |
---|---|---|
committer | Markus Koivisto <markus@vaadin.com> | 2014-08-13 10:23:10 +0000 |
commit | 7a49a096ab82a2f9a745c16c089cba85e8fa5c13 (patch) | |
tree | a551e5e72c75e363bf1900c5c5dfd3c2ccf0fd9d /uitest | |
parent | 5edc32fa0ba7a7c29190f57697b4398a78d05dd2 (diff) | |
download | vaadin-framework-7a49a096ab82a2f9a745c16c089cba85e8fa5c13.tar.gz vaadin-framework-7a49a096ab82a2f9a745c16c089cba85e8fa5c13.zip |
Pressing [down]+[enter] on a combobox now closes the popup. (#14379)
Pressing down to open the popup menu and then pressing enter to select
the same item as is already selected will now cause the same behavior
as pressing the escape key when there are suggestions.
Change-Id: I6052608cc5916d306a981aa0f98b0ae822da5eb4
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java | 29 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java | 65 |
2 files changed, 94 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java new file mode 100644 index 0000000000..253d6a0d1e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java @@ -0,0 +1,29 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; + +public class ComboBoxSuggestionPopupClose extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final ComboBox select = new ComboBox("ComboBox"); + select.addItem("one"); + select.addItem("two"); + select.addItem("three"); + addComponent(select); + } + + @Override + protected String getTestDescription() { + return "Closing the suggestion popup using Enter key is " + + "broken in combobox when opening popup using Enter " + + "key and not changin the selection using arrows"; + } + + @Override + protected Integer getTicketNumber() { + return 14379; + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java new file mode 100644 index 0000000000..5e9e076cac --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java @@ -0,0 +1,65 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.combobox; + +import static org.junit.Assert.assertFalse; +import static org.openqa.selenium.Keys.ARROW_DOWN; +import static org.openqa.selenium.Keys.ENTER; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * @author Vaadin Ltd + */ +public class ComboBoxSuggestionPopupCloseTest extends MultiBrowserTest { + + private WebElement selectTextbox; + + @Test + public void closeSuggestionPopupTest() throws Exception { + openTestURL(); + + waitForElementVisible(By.className("v-filterselect")); + + selectTextbox = $(ComboBoxElement.class).first().findElement( + By.vaadin("#textbox")); + selectTextbox.click(); + + // open popup and select first element + sendKeys(new Keys[] { ARROW_DOWN, ARROW_DOWN, ENTER }); + + // open popup and hit enter to close it + sendKeys(new Keys[] { ARROW_DOWN, ENTER }); + + assertFalse(isElementPresent(By.className("v-filterselect-suggestmenu"))); + + } + + private void sendKeys(Keys[] keys) throws Exception { + for (Keys key : keys) { + selectTextbox.sendKeys(key); + // wait a while between the key presses, at least PhantomJS fails if + // they are sent too fast + sleep(10); + } + } +}; |