diff options
author | Artur Signell <artur@vaadin.com> | 2012-11-28 20:36:03 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-29 11:13:07 +0000 |
commit | d87c6f72508a4c76c0c2274bccaf4191bb5fa204 (patch) | |
tree | 9578855494ec87a254187c5d5e3a285a2c0500a5 /uitest/src/com/vaadin | |
parent | c4e6e44dde9c107c231422e48322805b50a09d05 (diff) | |
download | vaadin-framework-d87c6f72508a4c76c0c2274bccaf4191bb5fa204.tar.gz vaadin-framework-d87c6f72508a4c76c0c2274bccaf4191bb5fa204.zip |
Fixed tooltip handling for Table (#9088)
Change-Id: I0de74785fbc9eb68f958875031df59f1c61c8ec2
Diffstat (limited to 'uitest/src/com/vaadin')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html | 358 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java | 84 |
2 files changed, 428 insertions, 14 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html new file mode 100644 index 0000000000..eb3efc28fd --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html @@ -0,0 +1,358 @@ +<?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="http://arturwin.office.itmill.com:8888/" /> +<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/TableItemDescriptionGeneratorTest?restartApplication</td> + <td></td> +</tr> +<!--All on--> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Text</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Button 1 description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Textfield's own description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Cell and row tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>12,6</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Text</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Component</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Generated component</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Row and Component tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>7,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>7,5</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Button 1 description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Textfield's own description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Row tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>7,8</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java index e7176add0a..ec81194f14 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java @@ -2,50 +2,101 @@ package com.vaadin.tests.components.table; import com.vaadin.data.Container; import com.vaadin.data.Item; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; import com.vaadin.ui.Table; 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"; + private final String TEXT_PROPERTY_ID = "Text"; + private final String GEN_WIDGET_PROPERTY_ID = "Generated component"; + private final String WIDGET_PROPERTY_ID = "Component"; + private CheckBox componentDescription; + private CheckBox tableCellItemDescription; + private CheckBox tableRowItemDescription; @Override protected void setup() { - final Table table = new Table(); + final Table table = createTable(); table.setId("table"); - table.setContainerDataSource(createContainer()); + componentDescription = new CheckBox("Tooltip on components"); + componentDescription.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.setContainerDataSource(createContainer(componentDescription + .getValue())); + } + }); + componentDescription.setImmediate(true); + componentDescription.setValue(true); + tableCellItemDescription = new CheckBox("Tooltip on table cells"); + tableCellItemDescription + .addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.refreshRowCache(); + } + }); + tableCellItemDescription.setImmediate(true); + tableCellItemDescription.setValue(true); + + tableRowItemDescription = new CheckBox("Tooltip on table Rows"); + tableRowItemDescription + .addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + table.refreshRowCache(); + } + }); + tableRowItemDescription.setImmediate(true); + tableRowItemDescription.setValue(true); + + addComponent(componentDescription); + addComponent(tableCellItemDescription); + addComponent(tableRowItemDescription); addComponent(table); table.setItemDescriptionGenerator(new ItemDescriptionGenerator() { @Override public String generateDescription(Component source, Object itemId, Object propertyId) { - if (propertyId == null) { + if (propertyId == null && tableRowItemDescription.getValue()) { return "Row description " + itemId; - } else if (propertyId == COLUMN1_PROPERTY_ID) { + } else if (tableCellItemDescription.getValue()) { return "Cell description " + itemId + "," + propertyId; } return null; } }); - table.addGeneratedColumn(COLUMN3_PROPERTY_ID, + table.addGeneratedColumn(GEN_WIDGET_PROPERTY_ID, new Table.ColumnGenerator() { @Override public Component generateCell(Table source, Object itemId, Object columnId) { TextField lbl = new TextField(); - lbl.setDescription("Textfields own description"); + if (componentDescription.getValue()) { + lbl.setDescription("Textfield's own description"); + } return lbl; } }); + + } + + protected Table createTable() { + return new Table(); } @Override @@ -58,17 +109,22 @@ public class TableItemDescriptionGeneratorTest extends TestBase { return 5414; } - private Container createContainer() { + private Container createContainer(boolean description) { IndexedContainer container = new IndexedContainer(); - container.addContainerProperty(COLUMN1_PROPERTY_ID, String.class, ""); - container.addContainerProperty(COLUMN2_PROPERTY_ID, String.class, ""); + container.addContainerProperty(TEXT_PROPERTY_ID, String.class, ""); + container.addContainerProperty(WIDGET_PROPERTY_ID, Component.class, + null); // 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(TEXT_PROPERTY_ID).setValue("Text " + i); + Button b = new Button("Button " + i); + if (description) { + b.setDescription("Button " + i + " description"); + } + item.getItemProperty(WIDGET_PROPERTY_ID).setValue(b); // item.getItemProperty(COLUMN3_PROPERTY_ID).setValue("last" + i); } |