This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
185 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/test/java/com/vaadin/flow/component/combobox/test/ClientSideFilterIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright 2000-2018 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.flow.component.combobox.test; | ||
|
||
import com.vaadin.flow.component.combobox.ComboBoxElementUpdated; | ||
import com.vaadin.flow.component.combobox.testbench.ComboBoxElement; | ||
import com.vaadin.flow.testutil.TestPath; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.Keys; | ||
|
||
@TestPath("clientside-filter") | ||
public class ClientSideFilterIT extends AbstractComboBoxIT { | ||
@Before | ||
public void init() { | ||
open(); | ||
waitUntil(driver -> findElements(By.tagName("vaadin-combo-box")) | ||
.size() > 0); | ||
} | ||
|
||
@Test | ||
public void filter_itemsShouldBeThere() { | ||
// First combobox. | ||
ComboBoxElement comboBox = $(ComboBoxElementUpdated.class).first(); | ||
|
||
comboBox.sendKeys("2"); | ||
|
||
waitForItems(comboBox, items -> items.size() == 1 | ||
&& "Option 2".equals(getItemLabel(items, 0))); | ||
|
||
comboBox.sendKeys(Keys.BACK_SPACE); | ||
|
||
waitForItems(comboBox, items -> items.size() == 4); | ||
|
||
comboBox.sendKeys("3"); | ||
|
||
waitForItems(comboBox, items -> items.size() == 1 | ||
&& "Option 3".equals(getItemLabel(items, 0))); | ||
|
||
// Second combobox. | ||
comboBox = $(ComboBoxElementUpdated.class).get(1); | ||
|
||
comboBox.sendKeys("mo"); | ||
|
||
waitForItems(comboBox, | ||
items -> items.size() == 1 | ||
&& "Mozilla Firefox".equals(getItemLabel(items, 0))); | ||
|
||
comboBox.closePopup(); | ||
comboBox.openPopup(); | ||
|
||
waitForItems(comboBox, | ||
items -> items.size() == 5 | ||
&& "Google Chrome".equals(getItemLabel(items, 0)) | ||
&& "Mozilla Firefox".equals(getItemLabel(items, 1)) | ||
&& "Opera".equals(getItemLabel(items, 2)) | ||
&& "Apple Safari".equals(getItemLabel(items, 3)) | ||
&& "Microsoft Edge".equals(getItemLabel(items, 4))); | ||
|
||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/test/java/com/vaadin/flow/component/combobox/test/ClientSideFilterPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2000-2018 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.flow.component.combobox.test; | ||
|
||
import com.vaadin.flow.component.combobox.ComboBox; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.component.html.Hr; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@Route("clientside-filter") | ||
public class ClientSideFilterPage extends Div { | ||
|
||
public ClientSideFilterPage() { | ||
ComboBox<String> cb = new ComboBox<>("Choose option", "Option 2", | ||
"Option 3", "Option 4", "Option 5"); | ||
this.add(cb); | ||
cb.focus(); | ||
|
||
this.add(new Hr()); | ||
|
||
ComboBox<String> testBox = new ComboBox<>("Browsers"); | ||
testBox.setItems("Google Chrome", "Mozilla Firefox", "Opera", | ||
"Apple Safari", "Microsoft Edge"); | ||
this.add(testBox); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters