aboutsummaryrefslogtreecommitdiffstats
path: root/testbench-api
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-03-23 15:28:37 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-23 15:28:37 +0200
commit6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b (patch)
tree419be55a19b6c4ef65876392b6e31091e1ff5c28 /testbench-api
parent17b3f23b0e526250dc134df1f7d2e6cd7f149ba5 (diff)
downloadvaadin-framework-6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b.tar.gz
vaadin-framework-6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b.zip
Add feature to disable collapsing items in TreeGrid (#8879)
Fixes #8846
Diffstat (limited to 'testbench-api')
-rw-r--r--testbench-api/src/main/java/com/vaadin/testbench/elements/TreeGridElement.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeGridElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeGridElement.java
index 0ca81a56ef..ed02041e06 100644
--- a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeGridElement.java
+++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeGridElement.java
@@ -15,6 +15,9 @@
*/
package com.vaadin.testbench.elements;
+import java.util.Arrays;
+import java.util.List;
+
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
@@ -97,8 +100,9 @@ public class TreeGridElement extends GridElement {
public boolean isRowExpanded(int rowIndex, int hierarchyColumnIndex) {
WebElement expandElement = getExpandElement(rowIndex,
hierarchyColumnIndex);
- return expandElement.getAttribute("expanded") != null
- && expandElement.getAttribute("collapsed") == null;
+ List<String> classes = Arrays
+ .asList(expandElement.getAttribute("class").split(" "));
+ return classes.contains("expanded") && !classes.contains("collapsed");
}
/**
@@ -111,10 +115,7 @@ public class TreeGridElement extends GridElement {
* @return {@code true} if collapsed, {@code false} if expanded
*/
public boolean isRowCollapsed(int rowIndex, int hierarchyColumnIndex) {
- WebElement expandElement = getExpandElement(rowIndex,
- hierarchyColumnIndex);
- return expandElement.getAttribute("collapsed") != null
- && expandElement.getAttribute("expanded") == null;
+ return !isRowExpanded(rowIndex, hierarchyColumnIndex);
}
/**