aboutsummaryrefslogtreecommitdiffstats
path: root/testbench-api/src/main/java/com/vaadin/testbench
diff options
context:
space:
mode:
authorSun Zhe <31067185+ZheSun88@users.noreply.github.com>2019-03-06 16:18:40 +0200
committerGitHub <noreply@github.com>2019-03-06 16:18:40 +0200
commit41ef058ba8a99d7603e98e122b9e60fa2dbf33c9 (patch)
tree97e9899ab27b864102c73ffff95beba850ccceaf /testbench-api/src/main/java/com/vaadin/testbench
parent6854108f316d04b8c5c10cc0add38f6158b43845 (diff)
downloadvaadin-framework-41ef058ba8a99d7603e98e122b9e60fa2dbf33c9.tar.gz
vaadin-framework-41ef058ba8a99d7603e98e122b9e60fa2dbf33c9.zip
Fix ComboBoxElement clear method (#11483)
Explicitly reset the value in case if it was cleared. Ignore the case for selecting a suggestion. Fixes vaadin/testbench#1122
Diffstat (limited to 'testbench-api/src/main/java/com/vaadin/testbench')
-rw-r--r--testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java
index e000b0bddd..23b9a98502 100644
--- a/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java
+++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java
@@ -52,8 +52,8 @@ public class ComboBoxElement extends AbstractSingleSelectElement {
selectByTextFromPopup(text);
return;
}
- getInputField().clear();
- getInputField().sendKeys(text);
+ clear();
+ sendKeys(text);
selectSuggestion(text);
}
@@ -231,6 +231,11 @@ public class ComboBoxElement extends AbstractSingleSelectElement {
@Override
public void clear() {
getInputField().clear();
+ String value = getText();
+ if (value != null && !value.isEmpty()) {
+ ((JavascriptExecutor) getDriver())
+ .executeScript("arguments[0].value = ''", getInputField());
+ }
}
@Override