summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-01-12 09:11:11 +0200
committerPekka Hyvönen <pekka@vaadin.com>2017-01-12 09:11:11 +0200
commit6897f6dcef2aa7b352529a3c34b86c69985ba788 (patch)
tree0fed4dd0251a17fea9b8efb08bdf13c08a57dd3f /uitest
parent62c0d733b77fc9ad8ab3a6f5f6bb632a5afdc299 (diff)
downloadvaadin-framework-6897f6dcef2aa7b352529a3c34b86c69985ba788.tar.gz
vaadin-framework-6897f6dcef2aa7b352529a3c34b86c69985ba788.zip
Reset selected icon when blurring a ComboBox (#8082)
* Reset selected icon when blurring a ComboBox Fixes #8073 * Merge branch '7.7' into _combobox-icon-reset-selection * Merge branch '7.7' into _combobox-icon-reset-selection
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java42
1 files changed, 41 insertions, 1 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java
index 15c87b65f0..2b8ffa1583 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxItemIconTest.java
@@ -1,7 +1,10 @@
package com.vaadin.tests.components.combobox;
+import org.junit.Assert;
import org.junit.Test;
+import org.openqa.selenium.Keys;
+import com.vaadin.testbench.By;
import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.tests.tb3.newelements.ComboBoxElement;
@@ -29,4 +32,41 @@ public class ComboBoxItemIconTest extends MultiBrowserTest {
compareScreen("fi-au-selected");
}
-} \ No newline at end of file
+ @Test
+ public void iconResetOnSelectionCancelByEscape() {
+ openTestURL();
+ ComboBoxElement cb = $(ComboBoxElement.class).get(1);
+
+ assertSelection(cb, "hu.gif", "Hungary");
+ cb.openPopup();
+ cb.sendKeys(Keys.UP);
+ assertSelection(cb, "au.gif", "Australia");
+ cb.sendKeys(Keys.ESCAPE);
+ assertSelection(cb, "hu.gif", "Hungary");
+ }
+
+ @Test
+ public void iconResetOnSelectionCancelByClickingOutside() {
+ openTestURL();
+ ComboBoxElement cb = $(ComboBoxElement.class).get(1);
+
+ assertSelection(cb, "hu.gif", "Hungary");
+ cb.openPopup();
+ cb.sendKeys(Keys.UP);
+ assertSelection(cb, "au.gif", "Australia");
+ findElement(By.tagName("body")).click();
+ assertSelection(cb, "hu.gif", "Hungary");
+
+ }
+
+ private void assertSelection(ComboBoxElement cb, String imageSuffix,
+ String caption) {
+ Assert.assertEquals(caption, cb.getValue());
+ String imgSrc = cb.findElement(By.className("v-icon"))
+ .getAttribute("src");
+ imgSrc = imgSrc.substring(imgSrc.lastIndexOf('/') + 1);
+ Assert.assertEquals(imageSuffix, imgSrc);
+
+ }
+
+}