summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tb3
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2015-01-08 09:48:49 +0200
committerAnna Koskinen <anna@vaadin.com>2015-02-26 17:21:19 +0200
commitacb889336f80227d609b194e56ac6ae3ead0d338 (patch)
treeb41488f3b5b6f31b19ed7a10841b05fb043394bb /uitest/src/com/vaadin/tests/tb3
parent5830a1f96b24186a68023258630ef1d89590d31e (diff)
downloadvaadin-framework-acb889336f80227d609b194e56ac6ae3ead0d338.tar.gz
vaadin-framework-acb889336f80227d609b194e56ac6ae3ead0d338.zip
Redesign ComboBox filtering, highlighting and selection behaviour.
(#15502, #9369) Changes: - When opening the popup, the first suggestion is always highlighted by default unless adding new items is allowed. - When filter matches currently selected item, that item will be highlighted instead of the first item. - Hitting enter or tab will always select the highlighted item. - Closing the suggestions list by clicking outside the list no longer selects an item to prevent accidental selections. Test changes: - Extended ComboBoxElement to help test filtering. - Updated and tweaked ComboBoxResetValueTest, ComboBoxIdenticalItemsTest and ComboboxScrollableWindowTest. - Added ComboBoxSelectingTest and ComboBoxSelectingWithNewItemsAllowedTest. - Updated some tests that were using keyboard navigation. Change-Id: Ia7745b624bdb0b1a1bb498157ebcb37bee219d76
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/newelements/ComboBoxElement.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/ComboBoxElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/ComboBoxElement.java
new file mode 100644
index 0000000000..6a0f164b13
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tb3/newelements/ComboBoxElement.java
@@ -0,0 +1,54 @@
+package com.vaadin.tests.tb3.newelements;
+
+import org.junit.Assert;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.ui.ComboBox")
+public class ComboBoxElement extends
+ com.vaadin.testbench.elements.ComboBoxElement {
+
+ public WebElement getInputField() {
+ return findElement(By.vaadin("#textbox"));
+ }
+
+ @Override
+ public String getText() {
+ return getInputField().getAttribute("value");
+ }
+
+ @Override
+ public void clear() {
+ getInputField().clear();
+ }
+
+ @Override
+ public void sendKeys(CharSequence... keysToSend) {
+ sendKeys(50, keysToSend);
+ }
+
+ /**
+ * Use this method to simulate typing into an element, which may set its
+ * value.
+ *
+ * @param delay
+ * delay after sending each individual key (mainly needed for
+ * PhantomJS)
+ * @param keysToSend
+ * keys to type into the element
+ */
+ public void sendKeys(int delay, CharSequence... keysToSend) {
+ WebElement input = getInputField();
+
+ for (CharSequence key : keysToSend) {
+ input.sendKeys(key);
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+}