summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorMarco Collovati <mcollovati@gmail.com>2017-12-28 10:54:17 +0100
committerPekka Hyvönen <pekka@vaadin.com>2017-12-28 11:54:17 +0200
commitaa1371c84a5642c8b01603764291b746ff85f79d (patch)
treedef3745b21223ecfb3f0df9ef322e7331e6aa40e /uitest
parentb35d2ae8724b4639398b87e89034f1781bf08832 (diff)
downloadvaadin-framework-aa1371c84a5642c8b01603764291b746ff85f79d.tar.gz
vaadin-framework-aa1371c84a5642c8b01603764291b746ff85f79d.zip
Add css class to selected items in CheckboxGroup and RadiobuttonGroup (#10394)
Adds v-select-option-selected class to the selected group items in CheckboxGroup and RadiobuttonGroup Fixes #3387
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java12
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java27
2 files changed, 39 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java
index 66589956b9..98b09a6e60 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java
@@ -375,6 +375,18 @@ public class CheckBoxGroupTest extends MultiBrowserTest {
verifyCheckboxDisabledClassNames(className, true);
}
+ @Test // #3387
+ public void shouldApplySelectedClassToSelectedItems() {
+ openTestURL("theme=valo");
+ selectMenuPath("Component", "Selection", "Toggle Item 5");
+
+ String className = getSelect().getOptionElements().get(5).getAttribute("className");
+ assertTrue("No v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+
+ selectMenuPath("Component", "Selection", "Toggle Item 5");
+ className = getSelect().getOptionElements().get(5).getAttribute("className");
+ assertFalse("Extra v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+ }
// needed to make tooltips work in IE tests
@Override
protected boolean requireWindowFocusForIE() {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java
index 96fc66fd1d..a8fa91c51c 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupTest.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.components.radiobuttongroup;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.List;
@@ -195,6 +196,32 @@ public class RadioButtonGroupTest extends MultiBrowserTest {
verifyRadioButtonDisabledClassNames(className, true);
}
+ @Test // #3387
+ public void shouldApplySelectedClassToSelectedItems() {
+ openTestURL("theme=valo");
+ selectMenuPath("Component", "Selection", "Toggle Item 5");
+
+ String className = getSelect().findElements(By.tagName("span")).get(5).getAttribute("className");
+ assertTrue("No v-select-option-selected class, was " + className, className.contains("v-select-option-selected")
+ );
+
+ getSelect().selectByText("Item 5");
+ className = getSelect().findElements(By.tagName("span")).get(5).getAttribute("className");
+ assertTrue("No v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+
+ getSelect().selectByText("Item 10");
+ List<WebElement> options = getSelect().findElements(By.tagName("span"));
+ className = options.get(5).getAttribute("className");
+ assertFalse("Extra v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+ className = options.get(10).getAttribute("className");
+ assertTrue("No v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+
+ selectMenuPath("Component", "Selection", "Toggle Item 10");
+ className = getSelect().findElements(By.tagName("span")).get(10).getAttribute("className");
+ assertFalse("Extra v-select-option-selected class, was " + className, className.contains("v-select-option-selected"));
+ }
+
+
@Test
public void itemIconGenerator() {
selectMenuPath("Component", "Item Icon Generator",