summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java21
3 files changed, 21 insertions, 6 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
index 8e22672641..12d76bec9f 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
@@ -825,7 +825,7 @@ public class VTree extends FocusElementPanel
*/
public boolean isCaptionElement(
com.google.gwt.dom.client.Element target) {
- return (target == nodeCaptionSpan
+ return (nodeCaptionSpan.isOrHasChild(target)
|| (icon != null && target == icon.getElement()));
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
index 604847c867..106b5771a6 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
@@ -28,18 +28,20 @@ public class TreeHtmlContentAllowed extends AbstractReindeerTestUI {
String htmlParent = "Some <b>html</b>";
String textChild = "Child text";
String htmlChild = "Child <i>html</i>";
+ String htmlElementChild = "Child <span id='my-html-element'>element html</span>";
final Tree tree = new Tree("A tree");
tree.addItem(textParent);
tree.addItem(htmlParent);
tree.addItem(textChild);
tree.addItem(htmlChild);
-
+ tree.addItem(htmlElementChild);
tree.setParent(textChild, textParent);
tree.setParent(htmlChild, htmlParent);
tree.setChildrenAllowed(textChild, false);
tree.setChildrenAllowed(htmlChild, false);
+ tree.setChildrenAllowed(htmlElementChild, false);
final CheckBox toggle = new CheckBox("HTML content allowed",
tree.isHtmlContentAllowed());
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
index e784f990f3..613100078e 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
@@ -37,19 +37,32 @@ public class TreeHtmlContentAllowedTest extends SingleBrowserTest {
"unchecked", toggle.getValue());
// Markup is seen as plain text
- assertTreeCaptionTexts("Just text", "Some <b>html</b>");
+ assertTreeCaptionTexts("Just text", "Some <b>html</b>",
+ "Child <span id='my-html-element'>element html</span>");
toggle.click();
- assertTreeCaptionTexts("Just text", "Some html");
+ assertTreeCaptionTexts("Just text", "Some html", "Child element html");
// Expand the HTML parent
findElements(By.className("v-tree-node")).get(1).click();
- assertTreeCaptionTexts("Just text", "Some html", "Child html");
+ assertTreeCaptionTexts("Just text", "Some html", "Child html",
+ "Child element html");
toggle.click();
assertTreeCaptionTexts("Just text", "Some <b>html</b>",
- "Child <i>html</i>");
+ "Child <i>html</i>",
+ "Child <span id='my-html-element'>element html</span>");
+
+ toggle.click();
+ findElements(By.id("my-html-element")).get(0).click();
+ assertHtmlElementSelected();
+
+ }
+
+ private void assertHtmlElementSelected() {
+ TreeElement tree = $(TreeElement.class).first();
+ Assert.assertEquals(tree.getValue(), "Child element html");
}
private void assertTreeCaptionTexts(String... captions) {