summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-04-15 17:35:18 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-24 07:01:08 +0000
commit7900166360dac2d2ae8885e0151f46cad472805f (patch)
treea8734d0c3ad12ed6f437a5923f158486e6775c26
parentc8ed703a5899d62f711bc184ada5309a0b81564e (diff)
downloadvaadin-framework-7900166360dac2d2ae8885e0151f46cad472805f.tar.gz
vaadin-framework-7900166360dac2d2ae8885e0151f46cad472805f.zip
TestBench test for tree (#11612)
Together with fix for tree to pass the test Change-Id: I3d6bead220ab61b171a267d15bda2570f7351d49
-rw-r--r--client/src/com/vaadin/client/ui/VTree.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/SimpleTree.html270
2 files changed, 273 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/VTree.java b/client/src/com/vaadin/client/ui/VTree.java
index e08b483c8c..51c00ca310 100644
--- a/client/src/com/vaadin/client/ui/VTree.java
+++ b/client/src/com/vaadin/client/ui/VTree.java
@@ -877,7 +877,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
String labelId = DOM.createUniqueId();
addStyleName(CLASSNAME);
- getElement().setId(DOM.createUniqueId());
+ String treeItemId = DOM.createUniqueId();
+ getElement().setId(treeItemId);
Roles.getTreeitemRole().set(getElement());
Roles.getTreeitemRole().setAriaSelectedState(getElement(),
SelectedValue.FALSE);
@@ -889,6 +890,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
+ "-caption");
Element wrapper = DOM.createDiv();
wrapper.setId(labelId);
+ wrapper.setAttribute("for", treeItemId);
nodeCaptionSpan = DOM.createSpan();
DOM.appendChild(getElement(), nodeCaptionDiv);
diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html
new file mode 100644
index 0000000000..a446f67726
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html
@@ -0,0 +1,270 @@
+<?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>SimpleTree</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SimpleTree</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tree.SimpleTree?restartApplication</td>
+ <td></td>
+</tr>
+<!--Caption-->
+<tr>
+ <td>verifyElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@id</td>
+ <td>captionid</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@aria-labelledby</td>
+ <td>${captionid}</td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@id</td>
+ <td>treeid</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@for</td>
+ <td>${treeid}</td>
+</tr>
+<!--Tree-->
+<tr>
+ <td>verifyElementPresent</td>
+ <td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[@aria-multiselectable='false']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[2]/div[@role='tree']</td>
+ <td></td>
+</tr>
+<!--Treeitem-->
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@id</td>
+ <td>captionid</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@aria-labelledby</td>
+ <td>${captionid}</td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+ <td>treeitem10id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@for</td>
+ <td>${treeitem10id}</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-level</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]@role</td>
+ <td>group</td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@id</td>
+ <td>treeitem11id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem11id}@role</td>
+ <td>treeitem</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem11id}@aria-level</td>
+ <td>2</td>
+</tr>
+<!--Open/Close-->
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-expanded</td>
+ <td>true</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>xpath=//div[@id='${treeitem10id}']</td>
+ <td>5,5</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-expanded</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>xpath=//div[@id='${treeitem10id}']</td>
+ <td>5,5</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-expanded</td>
+ <td>true</td>
+</tr>
+<!--Root Selected-->
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[1]/div[1]/span[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+ <td>treeitem10id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-selected</td>
+ <td>true</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+ <td>false</td>
+</tr>
+<!--First child selected-->
+<tr>
+ <td>mouseClick</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]/div[1]/div[1]/span[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+ <td>treeitem10id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+ <td>true</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+ <td>false</td>
+</tr>
+<!--Last child selected-->
+<tr>
+ <td>mouseClick</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]/div[1]/div[1]/span[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+ <td>treeitem10id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+ <td>true</td>
+</tr>
+<!--Another root selected-->
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td>
+ <td>true</td>
+</tr>
+<tr>
+ <td>storeAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+ <td>treeitem10id</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>${treeitem10id}@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+ <td>false</td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+ <td>false</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>