summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2011-08-15 13:50:27 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2011-08-15 13:50:27 +0000
commit5737ec8704d717084ca91494f7bf9b08ad3eec8c (patch)
tree80ad0b8412c1d47ea56208181cc82cda17de31be /tests
parent283957d8baa78de674d1b9122755587c0f106d9f (diff)
downloadvaadin-framework-5737ec8704d717084ca91494f7bf9b08ad3eec8c.tar.gz
vaadin-framework-5737ec8704d717084ca91494f7bf9b08ad3eec8c.zip
Added tooltips to Table cells and rows (ItemDescriptionGenerator) + Testbench test for them #5414
svn changeset:20392/svn branch:6.7
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java75
-rw-r--r--tests/src/com/vaadin/tests/components/table/TableTooltips.html77
2 files changed, 152 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java b/tests/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java
new file mode 100644
index 0000000000..2f53b91107
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java
@@ -0,0 +1,75 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator;
+import com.vaadin.ui.TextField;
+
+public class TableItemDescriptionGeneratorTest extends TestBase {
+
+ private final String COLUMN1_PROPERTY_ID = "Text - Cell description";
+ private final String COLUMN2_PROPERTY_ID = "Text - Row description";
+ private final String COLUMN3_PROPERTY_ID = "Widget";
+
+ @Override
+ protected void setup() {
+ final Table table = new Table();
+ table.setDebugId("table");
+ table.setContainerDataSource(createContainer());
+ addComponent(table);
+
+ table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
+ public String generateDescription(Component source, Object itemId,
+ Object propertyId) {
+ if(propertyId == null){
+ return "Row description "+ itemId;
+ } else if(propertyId == COLUMN1_PROPERTY_ID) {
+ return "Cell description " + itemId +","+propertyId;
+ }
+ return null;
+ }
+ });
+
+ table.addGeneratedColumn(COLUMN3_PROPERTY_ID, new Table.ColumnGenerator() {
+
+ public Component generateCell(Table source, Object itemId, Object columnId) {
+ TextField lbl = new TextField();
+ lbl.setDescription("Textfields own description");
+ return lbl;
+ }
+ });
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Cells and rows should have tooltips";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5414;
+ }
+
+ private Container createContainer() {
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty(COLUMN1_PROPERTY_ID, String.class, "");
+ container.addContainerProperty(COLUMN2_PROPERTY_ID, String.class, "");
+ // container.addContainerProperty(COLUMN3_PROPERTY_ID, String.class, "");
+
+ for (int i = 0; i < 5; i++) {
+ Item item = container.addItem("item " + i);
+ item.getItemProperty(COLUMN1_PROPERTY_ID).setValue("first" + i);
+ item.getItemProperty(COLUMN2_PROPERTY_ID).setValue("middle" + i);
+ // item.getItemProperty(COLUMN3_PROPERTY_ID).setValue("last" + i);
+ }
+
+ return container;
+ }
+
+}
diff --git a/tests/src/com/vaadin/tests/components/table/TableTooltips.html b/tests/src/com/vaadin/tests/components/table/TableTooltips.html
new file mode 100644
index 0000000000..989fb865c5
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/table/TableTooltips.html
@@ -0,0 +1,77 @@
+<?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.TableItemDescriptionGeneratorTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]</td>
+ <td>57,5</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>Cell description item 3,Text - Cell description</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
+ <td>810,153</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td>
+ <td>57,12</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>Row description item 1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
+ <td>1011,283</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VTextField[0]</td>
+ <td>58,10</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>Textfields own description</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>