diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-12-08 10:53:36 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-12-08 10:53:36 +0000 |
commit | 3b7884d57a59614fb00bff4d41dc0b80a5442d3a (patch) | |
tree | ef935a38775319dfb2cbd830c5c184401110e92b /tests | |
parent | 3c2b32e356cb74d972864d78fabe20a36f02a8ee (diff) | |
download | vaadin-framework-3b7884d57a59614fb00bff4d41dc0b80a5442d3a.tar.gz vaadin-framework-3b7884d57a59614fb00bff4d41dc0b80a5442d3a.zip |
Test application and disabled testbench script for #8076
svn changeset:22309/svn branch:6.7
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 | 57 | ||||
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java | 67 |
2 files changed, 124 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 new file mode 100644 index 0000000000..8d185b6219 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html2 @@ -0,0 +1,57 @@ +<?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.ProgrammaticUnselectInRange?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>23,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>24,3:shift</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>Item 2 is selected</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>Item 2 is not selected</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[0]</td> + <td>32,8:ctrl</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> + <td>Item 2 is not selected</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java new file mode 100644 index 0000000000..758fa4bf1a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java @@ -0,0 +1,67 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +public class ProgrammaticUnselectInRange extends TestBase { + + private static final String PROPERTY = "property"; + + final Label selectionLabel = new Label(); + final Table table = new Table(); + + @Override + protected void setup() { + table.addContainerProperty(PROPERTY, Integer.class, ""); + + table.setMultiSelect(true); + table.setSelectable(true); + table.setImmediate(true); + table.setPageLength(5); + + for (int i = 0; i < 5; i++) { + Integer value = Integer.valueOf(i + 1); + table.addItem(new Object[] { value }, value); + } + table.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + updateSelectionLabel(); + } + }); + + addComponent(table); + addComponent(selectionLabel); + addComponent(new Button("Deselect item 2", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.unselect(Integer.valueOf(2)); + } + })); + + updateSelectionLabel(); + } + + private void updateSelectionLabel() { + if (table.isSelected(Integer.valueOf(2))) { + selectionLabel.setValue("Item 2 is selected"); + } else { + selectionLabel.setValue("Item 2 is not selected"); + } + } + + @Override + protected String getDescription() { + return "Selecting items 1 - 3 using shift click, deselecting item 2 using the button and selecting item 5 using ctrl should keep item 2 deselected according to the server"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} |