diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2015-04-09 17:34:04 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-04-13 08:23:36 +0000 |
commit | 68c7963f085fc299ac9ebded9394b638c7392bb1 (patch) | |
tree | 0593ab527b14b0deac8407a9e064d5325fdf416b /server/tests | |
parent | b3b50eb368a8b6200200b6b1f1324d0fc63f4409 (diff) | |
download | vaadin-framework-68c7963f085fc299ac9ebded9394b638c7392bb1.tar.gz vaadin-framework-68c7963f085fc299ac9ebded9394b638c7392bb1.zip |
Declarative support for Tree inline data (#16321)
<v-tree> elements may now contain a hierarchy of <node> elements.
Change-Id: I6b1703aa4ec598cf0b3a6221f615727efbcbf0ad
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java index b5e86d0835..3fb69a9257 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java @@ -17,7 +17,7 @@ package com.vaadin.tests.server.component.tree; import org.junit.Test; -import com.vaadin.shared.ui.MultiSelectMode; +import com.vaadin.server.ExternalResource; import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.Tree; import com.vaadin.ui.Tree.TreeDragMode; @@ -31,34 +31,51 @@ import com.vaadin.ui.Tree.TreeDragMode; public class TreeDeclarativeTest extends DeclarativeTestBase<Tree> { @Test - public void testReadBasic() { - testRead(getBasicDesign(), getBasicExpected()); - } + public void testDragMode() { + String design = "<v-tree drag-mode='node' />"; - @Test - public void testWriteBasic() { - testWrite(getBasicDesign(), getBasicExpected()); - } + Tree tree = new Tree(); + tree.setDragMode(TreeDragMode.NODE); - private String getBasicDesign() { - return "<v-tree selectable='false' drag-mode='node' multiselect-mode='simple' />"; - } - - private Tree getBasicExpected() { - Tree t = new Tree(); - t.setSelectable(false); - t.setDragMode(TreeDragMode.NODE); - t.setMultiselectMode(MultiSelectMode.SIMPLE); - return t; + testRead(design, tree); + testWrite(design, tree); } @Test - public void testReadEmpty() { + public void testEmpty() { testRead("<v-tree />", new Tree()); + testWrite("<v-tree />", new Tree()); } @Test - public void testWriteEmpty() { - testWrite("<v-tree />", new Tree()); + public void testNodes() { + String design = "<v-tree>" // + + " <node text='Node'/>" // + + " <node text='Parent'>" // + + " <node text='Child'>" // + + " <node text='Grandchild'/>" // + + " </node>" // + + " </node>" // + + " <node text='With icon' icon='http://example.com/icon.png'/>" // + + "</v-tree>"; + + Tree tree = new Tree(); + + tree.addItem("Node"); + + tree.addItem("Parent"); + + tree.addItem("Child"); + tree.setParent("Child", "Parent"); + + tree.addItem("Grandchild"); + tree.setParent("Grandchild", "Child"); + + tree.addItem("With icon"); + tree.setItemIcon("With icon", new ExternalResource( + "http://example.com/icon.png")); + + testRead(design, tree); + testWrite(design, tree, true); } } |