Skip to content

Commit

Permalink
LookupField setFilter() doesn't work properly if LookupField already …
Browse files Browse the repository at this point in the history
…has a value #29
  • Loading branch information
jreznot committed Dec 17, 2018
1 parent 39059c5 commit 9cd3949
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import com.codeborne.selenide.SelenideElement;
import com.haulmont.masquerade.components.LookupField;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;

import static com.codeborne.selenide.Condition.*;
import static com.codeborne.selenide.Selectors.byClassName;
Expand Down Expand Up @@ -73,7 +75,10 @@ public LookupField setFilter(String filter) {
.shouldBe(enabled)
.click();

inputImpl.clear();
if (StringUtils.isNotEmpty(inputImpl.getValue())) {
// remove all if needed
inputImpl.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE);
}

if (!isNullOrEmpty(filter)) {
// todo may be replace with javascript set to speed up this call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import com.codeborne.selenide.SelenideElement;
import com.haulmont.masquerade.Components;
import com.haulmont.masquerade.components.LookupPickerField;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;

import static com.codeborne.selenide.Condition.*;
import static com.codeborne.selenide.Selectors.byClassName;
Expand Down Expand Up @@ -67,7 +69,10 @@ public LookupPickerField setFilter(String filter) {
.shouldBe(enabled)
.click();

inputImpl.clear();
if (StringUtils.isNotEmpty(inputImpl.getValue())) {
// remove all if needed
inputImpl.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE);
}

if (!isNullOrEmpty(filter)) {
// todo may be replace with javascript set to speed up this call
Expand Down

0 comments on commit 9cd3949

Please sign in to comment.