diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-08-21 12:01:32 +0300 |
---|---|---|
committer | Aleksi Hietanen <aleksi@vaadin.com> | 2017-08-21 12:01:32 +0300 |
commit | 5ef925daa91b1253f170f244e2a992f4f92979e1 (patch) | |
tree | d45284ba338b71140bf1be522c8782fb16c9aca9 /uitest | |
parent | 554f39ad0455623fbb1befc4444e67c809de5c0a (diff) | |
download | vaadin-framework-5ef925daa91b1253f170f244e2a992f4f92979e1.tar.gz vaadin-framework-5ef925daa91b1253f170f244e2a992f4f92979e1.zip |
Add item descriptions to Tree (#9840)
Fixes #9803
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java | 13 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java index edcb76e1ca..b18364ccb8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java @@ -1,10 +1,7 @@ package com.vaadin.tests.components.tree; import java.util.Arrays; -import java.util.Enumeration; import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.IntStream; import java.util.stream.Stream; import com.vaadin.annotations.Theme; @@ -76,6 +73,7 @@ public class TreeBasicFeatures extends AbstractTestUIWithLog { MenuItem componentMenu = menu.addItem("Component", null); createIconMenu(componentMenu.addItem("Icons", null)); createCaptionMenu(componentMenu.addItem("Captions", null)); + createDescriptionMenu(componentMenu.addItem("Descriptions", null)); createContentModeMenu(componentMenu.addItem("ContentMode", null)); createSelectionModeMenu(componentMenu.addItem("Selection Mode", null)); createRowHeightMenu(componentMenu.addItem("Row Height", null)); @@ -149,6 +147,15 @@ public class TreeBasicFeatures extends AbstractTestUIWithLog { }); } + private void createDescriptionMenu(MenuItem descriptionMenu) { + descriptionMenu.addItem("No Description", menu -> { + tree.setItemDescriptionGenerator(t -> null); + }); + descriptionMenu.addItem("String.valueOf", menu -> { + tree.setItemDescriptionGenerator(String::valueOf); + }); + } + private void createContentModeMenu(MenuItem contentModeMenu) { Arrays.stream(ContentMode.values()).forEach(mode -> contentModeMenu .addItem(mode.toString(), item -> tree.setContentMode(mode))); diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java index 4137e11098..34be123ee2 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java @@ -252,4 +252,12 @@ public class TreeBasicFeaturesTest extends MultiBrowserTest { .contains("height: " + height + "px;")); }); } + + @Test + public void tree_item_description() { + selectMenuPath("Component", "Descriptions", "String.valueOf"); + + $(TreeElement.class).first().getItem(0).showTooltip(); + Assert.assertEquals("", "0 | 0", getTooltipElement().getText()); + } } |