]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case for #8041
authorLeif Åstrand <leif@vaadin.com>
Mon, 5 Dec 2011 15:37:05 +0000 (15:37 +0000)
committerLeif Åstrand <leif@vaadin.com>
Mon, 5 Dec 2011 15:37:05 +0000 (15:37 +0000)
svn changeset:22237/svn branch:6.7

tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java [new file with mode: 0644]

diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html
new file mode 100644 (file)
index 0000000..efcbded
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.treetable.AddNodesOnExpand?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>11,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>11,7</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>collapsed</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java
new file mode 100644 (file)
index 0000000..5bf0370
--- /dev/null
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.treetable;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.Tree.CollapseEvent;
+import com.vaadin.ui.Tree.ExpandEvent;
+import com.vaadin.ui.TreeTable;
+
+public class AddNodesOnExpand extends TestBase {
+    private TreeTable treetable;
+
+    @Override
+    public void setup() {
+        treetable = new TreeTable();
+        treetable.setImmediate(true);
+        treetable.setWidth("100%");
+        treetable.setHeight(null);
+        treetable.setPageLength(0);
+        treetable.addContainerProperty("foo", String.class, "");
+        treetable.addListener(new Tree.ExpandListener() {
+            public void nodeExpand(ExpandEvent event) {
+                Object openedItemId = event.getItemId();
+                if (!treetable.hasChildren(openedItemId)) {
+                    for (int j = 0; j < 3; j++) {
+                        treetable.addItem(openedItemId + "-" + j);
+                        treetable.setParent(openedItemId + "-" + j,
+                                openedItemId);
+                    }
+                }
+            }
+        });
+        treetable.addListener(new Tree.CollapseListener() {
+            public void nodeCollapse(CollapseEvent event) {
+                /* Uncomment this to "fix" the TreeTable */
+                // orgTree.refreshRowCache();
+            }
+        });
+
+        for (int i = 0; i < 3; i++) {
+            treetable.addItem(Integer.valueOf(i));
+        }
+
+        addComponent(treetable);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Expanding a node and then collapsing it should not cause scrollbars to appear";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(8041);
+    }
+}
\ No newline at end of file