summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-10-01 17:48:40 +0300
committerHenri Sara <hesara@vaadin.com>2015-10-02 08:17:38 +0000
commit904ae72ed3ca7f9477d59bd7fd284bb254895f8b (patch)
tree64e4d04b86ce904c46e702c757694723d64cb09b /uitest
parent4e02b7e7402a1d79298787968065a7773e7e34a8 (diff)
downloadvaadin-framework-904ae72ed3ca7f9477d59bd7fd284bb254895f8b.tar.gz
vaadin-framework-904ae72ed3ca7f9477d59bd7fd284bb254895f8b.zip
Fix TreeTableContextClick support (#19056)
Change-Id: Ib6bac73ba96c4919df2e1bf5c9c83160707530bb
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java53
-rw-r--r--uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java32
2 files changed, 85 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java
new file mode 100644
index 0000000000..7d995710c9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.contextclick;
+
+import com.vaadin.data.Item;
+import com.vaadin.shared.ui.table.TableConstants.Section;
+import com.vaadin.tests.util.PersonContainer;
+import com.vaadin.ui.Table.TableContextClickEvent;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableContextClick extends
+ AbstractContextClickUI<TreeTable, TableContextClickEvent> {
+
+ @Override
+ protected TreeTable createTestComponent() {
+ TreeTable treeTable = new TreeTable();
+ treeTable.setContainerDataSource(PersonContainer.createWithTestData());
+ treeTable.setFooterVisible(true);
+ return treeTable;
+ }
+
+ @Override
+ protected void handleContextClickEvent(TableContextClickEvent event) {
+ String value = "";
+ Object propertyId = event.getPropertyId();
+ if (event.getItemId() != null) {
+ Item item = event.getComponent().getContainerDataSource()
+ .getItem(event.getItemId());
+ value += item.getItemProperty("firstName").getValue() + " ";
+ value += item.getItemProperty("lastName").getValue();
+ } else if (event.getSection() == Section.HEADER) {
+ value = testComponent.getColumnHeader(propertyId);
+ } else if (event.getSection() == Section.FOOTER) {
+ value = testComponent.getColumnFooter(propertyId);
+ }
+ log("ContextClickEvent value: " + value + ", propertyId: " + propertyId
+ + ", section: " + event.getSection());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java
new file mode 100644
index 0000000000..fa3a34be06
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.contextclick;
+
+import org.openqa.selenium.interactions.Actions;
+
+public class TreeTableContextClickTest extends TableContextClickTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return TreeTableContextClick.class;
+ }
+
+ @Override
+ protected void contextClick(org.openqa.selenium.WebElement e) {
+ new Actions(getDriver()).moveToElement(e, 10, 10).contextClick()
+ .perform();
+ };
+}