]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge of (#10609) to Vaadin 7.
authorAnna Koskinen <anna@vaadin.com>
Mon, 28 Jan 2013 16:07:50 +0000 (18:07 +0200)
committerAnna Koskinen <anna@vaadin.com>
Fri, 1 Feb 2013 12:21:11 +0000 (14:21 +0200)
Automated test for #9986.

Change-Id: I3ce8b61ac7efd8eaa7a1b16e786ce7c2edbad0a9

uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java

diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html
new file mode 100644 (file)
index 0000000..3aecf8b
--- /dev/null
@@ -0,0 +1,179 @@
+<?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>ValueAfterClearingContainer</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ValueAfterClearingContainer</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.table.ValueAfterClearingContainer?restartApplication</td>
+       <td></td>
+</tr>
+<!-- add items and select one of them -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>40,13</td>
+</tr>
+<!-- verify selection -->
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>1. Value changed to 2</td>
+</tr>
+<!-- remove items from table -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromTableButton/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>2. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>40,13</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>3. Value changed to 2</td>
+</tr>
+<!-- remove items from container -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerButton/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>4. Table selection: 2</td>
+</tr>
+<!-- replace the items -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that selection still exists -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>5. Table selection: 2</td>
+</tr>
+<!-- remove items from container and sanitize the table -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerAndSanitizeButton/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that sanitizing cleared the value -->
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>6. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>40,13</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>7. Value changed to 2</td>
+</tr>
+<!-- remove selected item from the table -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromTableButton/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>8. Value changed to null</td>
+</tr>
+<!-- select new item and remove it from the container -->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>40,13</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>9. Value changed to 3</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromContainer/domChild[0]</td>
+       <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>10. Table selection: 3</td>
+</tr>
+<!-- verify the item has been removed -->
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+       <td>40,13</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+       <td>11. Value changed to 4</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
index 93e7cafa996659cae5b7b29c7143bb8edd99c4c3..f378c146ea9d0ab34f17c92bfcb9d4866aa6c85b 100644 (file)
@@ -19,6 +19,8 @@ public class ValueAfterClearingContainer extends TestBase {
 
     @Override
     protected void setup() {
+        log.setId("log");
+        table.setId("table");
         table.setSelectable(true);
         table.addContainerProperty(PROPERTY_ID, Integer.class, null);
         table.setImmediate(true);
@@ -33,6 +35,7 @@ public class ValueAfterClearingContainer extends TestBase {
         addComponent(table);
         final CheckBox multiselect = new CheckBox("Multiselect");
         multiselect.setImmediate(true);
+        multiselect.setId("multiselect");
         multiselect.addValueChangeListener(new ValueChangeListener() {
 
             public void valueChange(ValueChangeEvent event) {
@@ -41,48 +44,64 @@ public class ValueAfterClearingContainer extends TestBase {
             }
         });
         addComponent(multiselect);
-        addComponent(new Button("Add table items", new Button.ClickListener() {
-            public void buttonClick(ClickEvent event) {
-                if (!table.getItemIds().isEmpty()) {
-                    Notification.show("Only possible when the table is empty");
-                    return;
-                } else {
-                    for (int i = 0; i < 5; i++) {
-                        table.addItem(new Object[] { Integer.valueOf(i) },
-                                Integer.valueOf(i));
+        Button addItemsButton = new Button("Add table items",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        if (!table.getItemIds().isEmpty()) {
+                            Notification
+                                    .show("Only possible when the table is empty");
+                            return;
+                        } else {
+                            for (int i = 0; i < 5; i++) {
+                                table.addItem(
+                                        new Object[] { Integer.valueOf(i) },
+                                        Integer.valueOf(i));
+                            }
+                        }
                     }
-                }
-            }
-        }));
+                });
+        addItemsButton.setId("addItemsButton");
+        addComponent(addItemsButton);
 
-        addComponent(new Button("Show value", new Button.ClickListener() {
-            public void buttonClick(ClickEvent event) {
-                log.log("Table selection: " + table.getValue());
-            }
-        }));
-
-        addComponent(new Button("Remove items from table",
+        Button showValueButton = new Button("Show value",
                 new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        log.log("Table selection: " + table.getValue());
+                    }
+                });
+        showValueButton.setId("showValueButton");
+        addComponent(showValueButton);
+
+        Button removeItemsFromTableButton = new Button(
+                "Remove items from table", new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         table.removeAllItems();
                     }
-                }));
+                });
+        removeItemsFromTableButton.setId("removeItemsFromTableButton");
+        addComponent(removeItemsFromTableButton);
 
-        addComponent(new Button("Remove items from container",
-                new Button.ClickListener() {
+        Button removeItemsFromContainerButton = new Button(
+                "Remove items from container", new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         table.getContainerDataSource().removeAllItems();
                     }
-                }));
-        addComponent(new Button("Remove items from container and sanitize",
+                });
+        removeItemsFromContainerButton.setId("removeItemsFromContainerButton");
+        addComponent(removeItemsFromContainerButton);
+        Button removeItemsFromContainerAndSanitizeButton = new Button(
+                "Remove items from container and sanitize",
                 new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         table.getContainerDataSource().removeAllItems();
                         table.sanitizeSelection();
                     }
-                }));
-        addComponent(new Button("Remove selected item from table",
-                new Button.ClickListener() {
+                });
+        removeItemsFromContainerAndSanitizeButton
+                .setId("removeItemsFromContainerAndSanitizeButton");
+        addComponent(removeItemsFromContainerAndSanitizeButton);
+        Button removeSelectedFromTableButton = new Button(
+                "Remove selected item from table", new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         Object selection = table.getValue();
                         if (selection == null) {
@@ -92,8 +111,11 @@ public class ValueAfterClearingContainer extends TestBase {
                             table.removeItem(selection);
                         }
                     }
-                }));
-        addComponent(new Button("Remove selected item from container",
+                });
+        removeSelectedFromTableButton.setId("removeSelectedFromTableButton");
+        addComponent(removeSelectedFromTableButton);
+        Button removeSelectedFromContainer = new Button(
+                "Remove selected item from container",
                 new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
                         Object selection = table.getValue();
@@ -105,7 +127,9 @@ public class ValueAfterClearingContainer extends TestBase {
                                     .removeItem(selection);
                         }
                     }
-                }));
+                });
+        removeSelectedFromContainer.setId("removeSelectedFromContainer");
+        addComponent(removeSelectedFromContainer);
     }
 
     @Override