summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-09-13 14:04:34 +0000
committerLeif Åstrand <leif@vaadin.com>2011-09-13 14:04:34 +0000
commit4287b85da1fd63f7d8ae4594d09d665d8b85233a (patch)
tree94dd1bf63bb9ecfb00e8a267cb2a379c1b803367
parentd31d699eb4c939fa78bb906e018da45e019c9eea (diff)
downloadvaadin-framework-4287b85da1fd63f7d8ae4594d09d665d8b85233a.tar.gz
vaadin-framework-4287b85da1fd63f7d8ae4594d09d665d8b85233a.zip
#7101 ComponentLocator should only return elements that are attached to the DOM
svn changeset:20993/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentLocator.java2
-rw-r--r--tests/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html62
2 files changed, 63 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
index 25edb0f7d2..e6d2e59020 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
@@ -326,7 +326,7 @@ public class ComponentLocator {
String parts[] = path.split(SUBPART_SEPARATOR, 2);
String widgetPath = parts[0];
Widget w = getWidgetFromPath(widgetPath);
- if (w == null) {
+ if (w == null || !Util.isAttachedAndDisplayed(w)) {
return null;
}
diff --git a/tests/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html b/tests/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html
new file mode 100644
index 0000000000..24e5e992ca
--- /dev/null
+++ b/tests/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html
@@ -0,0 +1,62 @@
+
+<?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.table.Tables?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>40,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+ <td>29,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>103,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>34,6</td>
+</tr>
+<tr>
+ <td>contextmenu</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VContextMenu[0]#option0</td>
+ <td>15,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>37,9</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VContextMenu[0]#option0</td>
+ <td>15,8</td>
+</tr>
+</tbody></table>
+</body>
+</html> \ No newline at end of file