diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/components')
290 files changed, 4070 insertions, 1039 deletions
diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIWithLog.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIWithLog.java index cace7c3404..a74692b169 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUIWithLog.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIWithLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java b/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java index 926af72a2f..c619ceb200 100644 --- a/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java +++ b/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java @@ -80,4 +80,4 @@ public class AddRemoveSetStyleNamesTest extends TestBase { return 8664; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java b/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java index dd95ff6842..853f2863ef 100644 --- a/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java +++ b/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java @@ -83,4 +83,4 @@ public class CustomComponentwithUndefinedSize extends TestBase { return layout; } } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/DisableEnableCascadeStyles.java b/uitest/src/com/vaadin/tests/components/DisableEnableCascadeStyles.java index 0279a92437..7c5f0c9282 100644 --- a/uitest/src/com/vaadin/tests/components/DisableEnableCascadeStyles.java +++ b/uitest/src/com/vaadin/tests/components/DisableEnableCascadeStyles.java @@ -143,4 +143,4 @@ public class DisableEnableCascadeStyles extends TestBase { return 8708; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/HierarchicalContainerSorting.java b/uitest/src/com/vaadin/tests/components/HierarchicalContainerSorting.java index d0638be54c..ec33b8f0e3 100644 --- a/uitest/src/com/vaadin/tests/components/HierarchicalContainerSorting.java +++ b/uitest/src/com/vaadin/tests/components/HierarchicalContainerSorting.java @@ -106,4 +106,4 @@ public class HierarchicalContainerSorting extends TestBase { return 3095; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/SaneErrorsTest.java b/uitest/src/com/vaadin/tests/components/SaneErrorsTest.java index 6cf49151b3..bf84695c3b 100644 --- a/uitest/src/com/vaadin/tests/components/SaneErrorsTest.java +++ b/uitest/src/com/vaadin/tests/components/SaneErrorsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java b/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java index b6358b6c56..982ff8d71e 100644 --- a/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java +++ b/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java b/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java index 49a3c29e2d..49539fcae1 100644 --- a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java +++ b/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java index b8afc11e4b..8b76b0e4e1 100644 --- a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java +++ b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java b/uitest/src/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java index 4bfd724c99..777eb4b518 100644 --- a/uitest/src/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java +++ b/uitest/src/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/abstractcomponent/RemSizeUnitTest.java b/uitest/src/com/vaadin/tests/components/abstractcomponent/RemSizeUnitTest.java index 98c0538cd8..5924ab7d32 100644 --- a/uitest/src/com/vaadin/tests/components/abstractcomponent/RemSizeUnitTest.java +++ b/uitest/src/com/vaadin/tests/components/abstractcomponent/RemSizeUnitTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java b/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java index 161f9cd520..716c1d4348 100644 --- a/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java +++ b/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java @@ -29,4 +29,4 @@ public class FieldFocusOnClick extends AbstractTestUI { protected Integer getTicketNumber() { return 11854; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html b/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html deleted file mode 100644 index a7b8e24ae7..0000000000 --- a/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.html +++ /dev/null @@ -1,203 +0,0 @@ -<?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://artur-laptop.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/com.vaadin.tests.components.abstractfield.ShortcutAddAndRemove?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/domChild[0]</td> - <td>316,58</td> -</tr> -<!--Enter on background - should cause event--> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>1. Log button was clicked</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>102,51</td> -</tr> -<!--Enter in textfield - should cause event--> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>2. Log button was clicked</td> -</tr> -<!--Remove shortcut--> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>110,62</td> -</tr> -<!--Enter in field - should not cause event--> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>97,26</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>up</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>down</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>down</td> -</tr> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>row1</td> -</tr> -<tr> - <td>keyPress</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>13</td> -</tr> -<tr> - <td>keyPress</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>r</td> -</tr> -<tr> - <td>keyPress</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>o</td> -</tr> -<tr> - <td>keyPress</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>w</td> -</tr> -<tr> - <td>keyPress</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>2</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>2. Log button was clicked</td> -</tr> -<!-- Commented out because TestBench does not enter the text correctly using keyPress in any browser except Firefox --> -<!-- <tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>row1<br />row2</td> -</tr>--> -<!--Add shortcut again--> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>85,46</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextArea[0]</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>3. Log button was clicked</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[2]/domChild[0]/domChild[0]</td> - <td>625,2</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>4. Log button was clicked</td> -</tr> -<!--Remove shortcut once more--> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/VVerticalLayout[0]</td> - <td>631,52</td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::</td> - <td>enter</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldShortcutAddAndRemove::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>4. Log button was clicked</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java b/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java index 309e297374..d6e8d72297 100644 --- a/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java +++ b/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java @@ -1,25 +1,22 @@ package com.vaadin.tests.components.abstractfield; import com.vaadin.event.ShortcutAction.KeyCode; -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.Log; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; -public class ShortcutAddAndRemove extends TestBase { +public class ShortcutAddAndRemove extends AbstractTestUIWithLog { - private Log log; - private TextArea textArea; + private TextField textField; @Override - protected void setup() { - log = new Log(4); - + protected void setup(VaadinRequest request) { final Button logButton = new Button("Log a row (enter shortcut)"); logButton.setClickShortcut(KeyCode.ENTER); - logButton.addListener(new ClickListener() { + logButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { log.log("Log button was clicked"); @@ -27,7 +24,7 @@ public class ShortcutAddAndRemove extends TestBase { }); final Button removeShortcut = new Button("Remove shortcut"); - removeShortcut.addListener(new ClickListener() { + removeShortcut.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { logButton.removeClickShortcut(); @@ -35,7 +32,7 @@ public class ShortcutAddAndRemove extends TestBase { } }); final Button addShortcut = new Button("Add shortcut"); - addShortcut.addListener(new ClickListener() { + addShortcut.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { logButton.setClickShortcut(KeyCode.ENTER); @@ -44,17 +41,17 @@ public class ShortcutAddAndRemove extends TestBase { }); addComponent(log); addComponent(logButton); - textArea = new TextArea("Enter key does not break lines ..."); - textArea.setRows(5); - textArea.setColumns(20); - addComponent(textArea); + textField = new TextField("Enter key is a shortcut..."); + textField.setWidth("20em"); + addComponent(textField); addComponent(removeShortcut); addComponent(addShortcut); } @Override - protected String getDescription() { + protected String getTestDescription() { + // TODO Auto-generated method stub return null; } diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemoveTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemoveTest.java new file mode 100644 index 0000000000..edae0a24c2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemoveTest.java @@ -0,0 +1,84 @@ +/* + * 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.components.abstractfield; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.elements.AbstractComponentElement; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.testbench.elements.VerticalLayoutElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ShortcutAddAndRemoveTest extends MultiBrowserTest { + + @Test + public void addAndRemoveShortcut() { + openTestURL(); + + VerticalLayoutElement mainLayout = $(VerticalLayoutElement.class) + .first(); + + TextFieldElement textField = $(TextFieldElement.class).first(); + // Enter in mainlayout -> should trigger shortcut + sendEnter(mainLayout); + assertLastLogRowIs("1. Log button was clicked"); + + // Enter in textfield -> should trigger shortcut + sendEnter(textField); + assertLastLogRowIs("2. Log button was clicked"); + + // Remove enter shortcut + removeEnterShortcut(); + + // Enter in field - should not trigger any shortcut anymore + sendEnter(textField); + assertLastLogRowIs("2. Log button was clicked"); + + // Add shortcut again + addEnterShortcut(); + sendEnter(textField); + assertLastLogRowIs("3. Log button was clicked"); + + sendEnter(mainLayout); + assertLastLogRowIs("4. Log button was clicked"); + + removeEnterShortcut(); + sendEnter(mainLayout); + assertLastLogRowIs("4. Log button was clicked"); + } + + private void removeEnterShortcut() { + $(ButtonElement.class).caption("Remove shortcut").first().click(); + } + + private void addEnterShortcut() { + $(ButtonElement.class).caption("Add shortcut").first().click(); + } + + private void assertLastLogRowIs(String expected) { + assertThat(getLogRow(0), is(expected)); + } + + private void sendEnter(AbstractComponentElement target) { + new Actions(getDriver()).click(target).sendKeys(Keys.ENTER).perform(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTab.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTab.java index da0ad3685a..46fdbac797 100644 --- a/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTab.java +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTab.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTabTest.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTabTest.java index 68aa61cc87..95b7a9c416 100644 --- a/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTabTest.java +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionAddTabTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContent.html b/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContent.html deleted file mode 100644 index 30414094c8..0000000000 --- a/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContent.html +++ /dev/null @@ -1,57 +0,0 @@ -<?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/AccordionTest?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::PID_Smenu#item0</td> - <td>45,2</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> - <td>136,8</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::Root/VOverlay[1]/VMenuBar[0]#item0</td> - <td>65,4</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::Root/VOverlay[2]/VMenuBar[0]#item1</td> - <td>86,2</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::Root/VOverlay[3]/VMenuBar[0]#item0</td> - <td>48,0</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runAccordionTest::PID_StestComponent/VAccordion$StackItem[0]/VNativeButton[0]</td> - <td>63,11</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>button-clicked</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContentTest.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContentTest.java new file mode 100644 index 0000000000..b4f830d106 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionClipsContentTest.java @@ -0,0 +1,57 @@ +/* + * 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.components.accordion; + +import org.junit.Test; + +import com.vaadin.testbench.elements.NativeButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class AccordionClipsContentTest extends MultiBrowserTest { + @Override + protected Class<?> getUIClass() { + return AccordionTest.class; + } + + @Test + public void testAccordionClipsContent() throws Exception { + openTestURL(); + + /* + * MenuBarElement doesn't have any API, so this part is ugly until + * #13364 is fixed + */ + + // Component + vaadinElement("PID_Smenu#item0").click(); + // Component container features + clickAt("Root/VOverlay[0]/VMenuBar[0]#item3", 136, 8); + // Add component + clickAt("Root/VOverlay[1]/VMenuBar[0]#item0", 65, 4); + // NativeButton + clickAt("Root/VOverlay[2]/VMenuBar[0]#item1", 86, 2); + // autoxauto + vaadinElement("Root/VOverlay[3]/VMenuBar[0]#item0").click(); + + $(NativeButtonElement.class).first().click(); + + compareScreen("button-clicked"); + } + + private void clickAt(String vaadinLocator, int x, int y) { + testBenchElement(vaadinElement(vaadinLocator)).click(x, y); + } +} diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTab.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTab.java new file mode 100644 index 0000000000..86e718596e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTab.java @@ -0,0 +1,78 @@ +/* + * Copyright 2000-2013 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.components.accordion; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Accordion; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet.Tab; +import com.vaadin.ui.VerticalLayout; + +/** + * Test UI for Accordion: tabs should stay selectable after remove tab. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class AccordionRemoveTab extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Accordion tabs = new Accordion(); + addComponent(tabs); + tabs.setHeight(300, Unit.PIXELS); + final VerticalLayout one = new VerticalLayout(); + one.setCaption("One"); + one.addComponent(new Label("On first tab")); + tabs.addTab(one); + VerticalLayout two = new VerticalLayout(); + two.setCaption("Two"); + two.addComponent(new Label("On second tab")); + tabs.addTab(two); + + tabs.setSelectedTab(two); + + VerticalLayout l = new VerticalLayout(); + l.addComponent(new Label("On third tab")); + Tab last = tabs.addTab(l); + last.setCaption("Three"); + + Button remove = new Button("Remove First"); + remove.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + tabs.removeComponent(tabs.iterator().next()); + } + }); + + addComponent(remove); + } + + @Override + protected String getTestDescription() { + return "Tabs should stay selectable after remove tab."; + } + + @Override + protected Integer getTicketNumber() { + return 11366; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java new file mode 100644 index 0000000000..f5651e0ada --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionRemoveTabTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2013 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.components.accordion; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for Accordion: tabs should stay selectable after remove tab. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class AccordionRemoveTabTest extends MultiBrowserTest { + + @Test + public void testRemoveTab() { + openTestURL(); + + WebElement button = driver.findElement(By.className("v-button")); + button.click(); + + checkFirstItemHeight("On second tab"); + + button.click(); + + checkFirstItemHeight("On third tab"); + } + + private void checkFirstItemHeight(String text) { + WebElement firstItem = driver.findElement(By + .className("v-accordion-item-first")); + WebElement label = firstItem.findElement(By.className("v-label")); + Assert.assertEquals("Unexpected text in first item", text, + label.getText()); + int height = firstItem.getSize().getHeight(); + WebElement accordion = driver.findElement(By.className("v-accordion")); + Assert.assertTrue("First item in accordion has unexpected height", + height > accordion.getSize().getHeight() / 2); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonClick.java b/uitest/src/com/vaadin/tests/components/button/ButtonClick.java index 30692649c5..9b10473d0f 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonClick.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonClick.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonClickTest.java b/uitest/src/com/vaadin/tests/components/button/ButtonClickTest.java index 77b35092de..4ea02b20d0 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonClickTest.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonClickTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java b/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java index 3d3d90728a..6031bff152 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonIOSDragTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java b/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java index 563342e240..cfec4d1100 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonTabIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java index 626ed1d250..25dd469903 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java @@ -35,4 +35,4 @@ public class ButtonToggleIcons extends UI { layout.addComponent(new Button("Toggle icon", iconToggleListener));
layout.addComponent(new NativeButton("Toggle icon", iconToggleListener));
}
-}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUpdateAltText.java b/uitest/src/com/vaadin/tests/components/button/ButtonUpdateAltText.java index 8286398623..dd89d1b9a7 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonUpdateAltText.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonUpdateAltText.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java index 3a5d61d793..ec40ef4649 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java index 6fbe77040f..161f927681 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java index 77225b2e4c..5b05d188bd 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java index 7477fc84ce..56c4eacba1 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java index 29b8f62403..b4e759b20b 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java index 8b789098e6..04b00dd039 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java +++ b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java index 6e5718a652..2313ad891a 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java +++ b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java index cc26cf8845..0513c9db4f 100644 --- a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java +++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerInputFormatsTest.java b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerInputFormatsTest.java new file mode 100644 index 0000000000..90c01116cc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerInputFormatsTest.java @@ -0,0 +1,98 @@ +/* + * 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.components.colorpicker; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test legal color values according to + * http://www.w3schools.com/cssref/css_colors_legal.asp + */ +public class ColorPickerInputFormatsTest extends MultiBrowserTest { + + @Override + protected Class<?> getUIClass() { + return ColorPickerTestUI.class; + } + + @Test + public void testRGBValue() throws Exception { + openTestURL(); + + setColorpickerValue("rgb(100,100,100)"); + + assertEquals("#646464", getColorpickerValue()); + } + + @Test + public void testRGBAValue() { + openTestURL(); + + setColorpickerValue("rgba(100,100,100, 0.5)"); + + assertEquals("#646464", getColorpickerValue()); + } + + @Test + public void testHSLValue() { + openTestURL(); + + setColorpickerValue("hsl(120,100%,50%)"); + + assertEquals("#00ff00", getColorpickerValue()); + } + + @Test + public void testHSLAValue() { + openTestURL(); + + setColorpickerValue("hsla(120,100%,50%, 0.3)"); + + assertEquals("#00ff00", getColorpickerValue()); + } + + private void setColorpickerValue(String value) { + + // Open colorpicker + getDriver().findElement(By.id("colorpicker1")).click(); + + // Add RGB value + WebElement field = getDriver().findElement( + By.className("v-colorpicker-preview-textfield")); + + // Select all text + field.sendKeys(Keys.chord(Keys.CONTROL, "a")); + + // Replace with rgb value + field.sendKeys(value); + + // Submit + field.sendKeys(Keys.ENTER); + } + + private String getColorpickerValue() { + WebElement field = getDriver().findElement( + By.className("v-colorpicker-preview-textfield")); + return field.getAttribute("value"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.html b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.html index 23c44d3cc0..48a4219c87 100644 --- a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.html +++ b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.html @@ -4,16 +4,16 @@ <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>ColorPickerTest</title> +<title>ColorPickerTestUI</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> -<tr><td rowspan="1" colspan="3">ColorPickerTest</td></tr> +<tr><td rowspan="1" colspan="3">ColorPickerTestUI</td></tr> </thead><tbody> <tr> <td>open</td> - <td>/run/com.vaadin.tests.components.colorpicker.ColorPickerTest?restartApplication</td> + <td>/run/com.vaadin.tests.components.colorpicker.ColorPickerTestUI?restartApplication</td> <td></td> </tr> @@ -25,17 +25,17 @@ </tr> <tr> <td>waitForElementPresent</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> <td></td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> <td>190,87</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> @@ -47,12 +47,12 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> <td>51,33</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> @@ -64,42 +64,42 @@ <!-- change foreground color with area button --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker5/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker5/domChild[1]</td> <td>10,15</td> </tr> <!-- expand history --> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]</td> <td></td> </tr> <!-- choose from history --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td> <td>9,9</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <!-- change background color with area button --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker6/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker6/domChild[1]</td> <td>12,24</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td> <td>9,12</td> </tr> <!-- choose from history --> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]</td> <td></td> </tr> <tr> @@ -123,59 +123,59 @@ <!-- open and close using area button --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker5/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker5/domChild[1]</td> <td>11,17</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker5/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker5/domChild[1]</td> <td>11,17</td> </tr> <!-- open background (using area button) to display HSV effects --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker6/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker6/domChild[1]</td> <td>21,15</td> </tr> <!-- HSV tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> <td>12,6</td> </tr> <!-- hue slider --> <tr> <td>dragAndDrop</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VSlider[0]/domChild[2]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VSlider[0]/domChild[2]/domChild[0]</td> <td>136,0</td> </tr> <!-- saturation slider --> <tr> <td>dragAndDrop</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VSlider[0]/domChild[2]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VSlider[0]/domChild[2]/domChild[0]</td> <td>100,0</td> </tr> <!-- value slider --> <tr> <td>dragAndDrop</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VSlider[0]/domChild[2]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VSlider[0]/domChild[2]/domChild[0]</td> <td>-60,0</td> </tr> <!-- Swatches tab (choose color) --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> <td>43,8</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCustomComponent[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[11]/domChild[9]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCustomComponent[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[11]/domChild[9]</td> <td>12,10</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> @@ -187,73 +187,73 @@ <!-- open foreground (using area button) to display checkbox effects --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Scolorpicker5/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Scolorpicker5/domChild[1]</td> <td>14,25</td> </tr> <!-- remove Swatches tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_SswaBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_SswaBox/domChild[0]</td> <td>9,6</td> </tr> <!-- remove css field --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_StxtBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_StxtBox/domChild[0]</td> <td>6,9</td> </tr> <!-- remove history --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_ShisBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_ShisBox/domChild[0]</td> <td>6,7</td> </tr> <!-- remove RGB tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_SrgbBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_SrgbBox/domChild[0]</td> <td>6,7</td> </tr> <!-- return RGB tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_SrgbBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_SrgbBox/domChild[0]</td> <td>6,7</td> </tr> <!-- remove HSV tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_ShsvBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_ShsvBox/domChild[0]</td> <td>6,9</td> </tr> <!-- return HSV tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_ShsvBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_ShsvBox/domChild[0]</td> <td>6,9</td> </tr> <!-- return css field --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_StxtBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_StxtBox/domChild[0]</td> <td>8,8</td> </tr> <!-- return history --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_ShisBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_ShisBox/domChild[0]</td> <td>6,8</td> </tr> <!-- return Swatches tab --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_SswaBox/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_SswaBox/domChild[0]</td> <td>4,8</td> </tr> <!-- close without choosing a new color --> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]</td> <td></td> </tr> @@ -265,12 +265,12 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> <td>148,127</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> @@ -287,29 +287,29 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[6]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[6]</td> <td>10,7</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <!-- change color of the last shade area --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Sshadearea_16/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Sshadearea_16/domChild[1]</td> <td>10,-65</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/Slot[1]/VColorPickerGradient[0]#clicklayer</td> <td>36,93</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> @@ -321,17 +321,17 @@ <!-- reset the color back to white --> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::PID_Sshadearea_16/domChild[1]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::PID_Sshadearea_16/domChild[1]</td> <td>19,-65</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[4]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCustomComponent[0]/VColorPickerGrid[0]/domChild[0]/domChild[1]/domChild[0]/domChild[4]</td> <td>6,7</td> </tr> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentscolorpickerColorPickerTestUI::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VHorizontalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]</td> <td></td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.java b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java index 0f7e639725..544cdafaf0 100644 --- a/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTest.java +++ b/uitest/src/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java @@ -1,3 +1,18 @@ +/* + * 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.components.colorpicker; import java.awt.Graphics; @@ -13,9 +28,10 @@ import javax.imageio.ImageIO; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.StreamResource; +import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.colorpicker.Color; import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.AbstractColorPicker; import com.vaadin.ui.Alignment; import com.vaadin.ui.CheckBox; @@ -30,10 +46,11 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.components.colorpicker.ColorChangeEvent; import com.vaadin.ui.components.colorpicker.ColorChangeListener; -public class ColorPickerTest extends TestBase implements ColorChangeListener { +public class ColorPickerTestUI extends AbstractTestUI implements + ColorChangeListener { @Override - protected String getDescription() { + public String getTestDescription() { return "Vaadin 7 compatible ColorPicker"; } @@ -178,7 +195,7 @@ public class ColorPickerTest extends TestBase implements ColorChangeListener { } @Override - protected void setup() { + protected void setup(VaadinRequest request) { getLayout().setWidth("1000px"); getLayout().setHeight(null); getLayout().addStyleName("colorpicker-mainwindow-content"); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainText.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainText.html deleted file mode 100644 index 9248938b28..0000000000 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainText.html +++ /dev/null @@ -1,80 +0,0 @@ -<?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></title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3"></td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.combobox.ComboBoxes2?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]</td> - <td>47,8</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]</td> - <td>I</td> -</tr> -<!--Open popup--> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[1]</td> - <td>14,10</td> -</tr> -<!--Close poup--> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[1]</td> - <td>14,10</td> -</tr> -<tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]</td> - <td>I</td> -</tr> -<!--Select a value--> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.combobox.ComboBoxes2?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[1]</td> - <td>14,10</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td> - <td>47,9</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]</td> - <td>I</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[1]</td> - <td>14,10</td> -</tr> -<!--Entered value should remain in the text field even though the popup is opened--> -<tr> - <td>assertValue</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]</td> - <td>I</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainTextTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainTextTest.java new file mode 100644 index 0000000000..a5efb44ec8 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxClosePopupRetainTextTest.java @@ -0,0 +1,60 @@ +/* + * 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.components.combobox; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ComboBoxClosePopupRetainTextTest extends MultiBrowserTest { + @Override + protected Class<?> getUIClass() { + return ComboBoxes2.class; + } + + @Test + public void testClosePopupRetainText() throws Exception { + openTestURL(); + + ComboBoxElement cb = $(ComboBoxElement.class).first(); + WebElement textbox = cb.findElement(By.vaadin("#textbox")); + textbox.sendKeys("I"); + cb.openPopup(); + cb.openPopup(); // openPopup() actually toggles + // The entered value should remain + assertEquals("I", textbox.getAttribute("value")); + } + + @Test + public void testClosePopupRetainText_selectingAValue() throws Exception { + openTestURL(); + ComboBoxElement cb = $(ComboBoxElement.class).first(); + cb.selectByText("Item 3"); + WebElement textbox = cb.findElement(By.vaadin("#textbox")); + textbox.clear(); + textbox.sendKeys("I"); + cb.openPopup(); + // Entered value should remain in the text field even though the popup + // is opened + assertEquals("I", textbox.getAttribute("value")); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java index 20a62f2a33..ccbde5f2df 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListener.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListener.java new file mode 100644 index 0000000000..8242eb9e57 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListener.java @@ -0,0 +1,65 @@ +/* + * Copyright 2000-2013 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.components.combobox; + +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComboBox; + +/** + * Test UI to verify that focus event actually update the ComboBox suggestion + * popup + * + * @author Vaadin Ltd + */ +public class ComboBoxItemAddingWithFocusListener extends AbstractTestUI { + + private ComboBox cBox; + + @Override + protected void setup(VaadinRequest request) { + cBox = new ComboBox(); + addComponent(cBox); + cBox.setImmediate(true); + cBox.addItem("Foo"); + cBox.addItem("Bar"); + cBox.addFocusListener(new FocusListener() { + + int x = 0; + + @Override + public void focus(FocusEvent event) { + cBox.addItem("Focus" + (x++)); + } + + }); + addComponent(new Button("Focus Target")); + } + + @Override + protected String getTestDescription() { + return "Item adding in focus listener causes popup to clear"; + } + + @Override + protected Integer getTicketNumber() { + return 13635; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListenerTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListenerTest.java new file mode 100644 index 0000000000..66173db554 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxItemAddingWithFocusListenerTest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2013 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.components.combobox; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ComboBoxItemAddingWithFocusListenerTest extends MultiBrowserTest { + + @Test + public void testPopupViewContainsAddedItem() { + openTestURL(); + ComboBoxElement cBox = $(ComboBoxElement.class).first(); + ButtonElement focusTarget = $(ButtonElement.class).first(); + cBox.openPopup(); + int i = 0; + while (i < 3) { + assertTrue("No item added on focus", cBox.getPopupSuggestions() + .contains("Focus" + i++)); + focusTarget.focus(); + ((TestBenchElement) cBox.findElement(By.vaadin("#textbox"))) + .focus(); + } + assertTrue("No item added on focus", cBox.getPopupSuggestions() + .contains("Focus" + i)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java index 84355c4d89..d1adeaaf88 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java @@ -78,4 +78,4 @@ public class ComboBoxParentDisable extends AbstractTestUIWithLog { protected Integer getTicketNumber() { return 10734; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java index 75010f0ea9..9f07d81cc9 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java @@ -123,4 +123,4 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase { connectionPool.releaseConnection(conn); } } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java new file mode 100644 index 0000000000..a052a29bba --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java @@ -0,0 +1,61 @@ +/* + * 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.components.combobox; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Label; + +public class ComboBoxSetNullWhenNewItemsAllowed extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final ComboBox comboBox = new ComboBox("My ComboBox"); + comboBox.setImmediate(true); + comboBox.setNullSelectionAllowed(false); + comboBox.setNewItemsAllowed(true); + for (int i = 0; i < 10; i++) { + comboBox.addItem("Item " + i); + } + + final Label value = new Label("Selected: "); + + comboBox.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + if (comboBox.getValue() != null) { + comboBox.setValue(null); + value.setValue("Selected: " + (String) comboBox.getValue()); + } + } + }); + addComponent(comboBox); + addComponent(value); + } + + @Override + protected String getTestDescription() { + return "ComboBox should clear its value when setting to null with new items."; + } + + @Override + protected Integer getTicketNumber() { + return 13413; + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java new file mode 100644 index 0000000000..54d355ab0a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java @@ -0,0 +1,54 @@ +/* + * 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.components.combobox; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchElementCommands; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * ComboBox should clear its value when setting to null with new items. + */ +public class ComboBoxSetNullWhenNewItemsAllowedTest extends MultiBrowserTest { + + @Test + public void testNewValueIsClearedAppropriately() + throws InterruptedException { + setDebug(true); + openTestURL(); + + WebElement element = $(ComboBoxElement.class).first().findElement( + By.vaadin("#textbox")); + ((TestBenchElementCommands) element).click(8, 7); + element.clear(); + element.sendKeys("New value"); + assertEquals("New value", element.getAttribute("value")); + if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { + new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); + } else { + element.sendKeys(Keys.RETURN); + } + assertEquals("", element.getAttribute("value")); + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java index dcd19f6b2a..02c212a3e1 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java +++ b/uitest/src/com/vaadin/tests/components/combobox/EscapeClosesComboboxNotWindow.java @@ -40,4 +40,4 @@ public class EscapeClosesComboboxNotWindow extends UI { layout.addComponent(button); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java index 4311ad1f08..9cebc58100 100644 --- a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java +++ b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java @@ -40,4 +40,4 @@ public class CustomComponentGrowingContent extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(7326); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/customfield/AddressField.java b/uitest/src/com/vaadin/tests/components/customfield/AddressField.java index 595a2e2cde..bc9f13c454 100644 --- a/uitest/src/com/vaadin/tests/components/customfield/AddressField.java +++ b/uitest/src/com/vaadin/tests/components/customfield/AddressField.java @@ -94,4 +94,4 @@ public class AddressField extends CustomField<Address> { public Class<Address> getType() { return Address.class; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/customfield/BooleanField.java b/uitest/src/com/vaadin/tests/components/customfield/BooleanField.java index 409ecccca8..20c004c068 100644 --- a/uitest/src/com/vaadin/tests/components/customfield/BooleanField.java +++ b/uitest/src/com/vaadin/tests/components/customfield/BooleanField.java @@ -43,4 +43,4 @@ public class BooleanField extends CustomField { public Class<?> getType() { return Boolean.class; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSize.java b/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSize.java index a3e19513b0..b6f46cadd0 100644 --- a/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSize.java +++ b/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSize.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSizeTest.java b/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSizeTest.java index c47ec0b792..a3f8f06976 100644 --- a/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSizeTest.java +++ b/uitest/src/com/vaadin/tests/components/customfield/CustomFieldSizeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/customfield/EmbeddedForm.java b/uitest/src/com/vaadin/tests/components/customfield/EmbeddedForm.java index d305afde1d..2703e01a27 100644 --- a/uitest/src/com/vaadin/tests/components/customfield/EmbeddedForm.java +++ b/uitest/src/com/vaadin/tests/components/customfield/EmbeddedForm.java @@ -64,4 +64,4 @@ public class EmbeddedForm extends Form { return super.removeItemProperty(id); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java index c192b561cc..0832f5afeb 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java +++ b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -45,4 +45,4 @@ public class AriaDisabled extends AbstractTestUI { protected Integer getTicketNumber() { return 13463; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java index 823638ef0c..f37042396b 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java index ce9d021c79..fc3c8c97e8 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java +++ b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEE.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java index 286da85f06..98094515e8 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormatEEETest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormats.java b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormats.java index 77637fb339..f51c75d57a 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormats.java +++ b/uitest/src/com/vaadin/tests/components/datefield/CustomDateFormats.java @@ -209,4 +209,4 @@ public class CustomDateFormats extends TestBase { protected Integer getTicketNumber() { return 5465; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForward.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForward.java new file mode 100644 index 0000000000..b38f58e5cc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForward.java @@ -0,0 +1,39 @@ +/* + * 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.components.datefield; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.InlineDateField; + +public class DateFieldFastForward extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addComponent(new InlineDateField()); + } + + @Override + protected String getTestDescription() { + return "Tests that right-click doesn't interfere with fast-forwarding (holding down left mouse button)."; + } + + @Override + protected Integer getTicketNumber() { + return 8012; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java new file mode 100644 index 0000000000..63d96e9bf9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldFastForwardTest.java @@ -0,0 +1,71 @@ +/* + * 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.components.datefield; + +import static org.junit.Assert.assertEquals; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.elements.VerticalLayoutElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DateFieldFastForwardTest extends MultiBrowserTest { + + @Test + public void testFastForwardOnRightMouseClick() throws Exception { + openTestURL(); + String firstMonth = getSelectedMonth(); + WebElement nextMonthButton = driver.findElement(By + .className("v-button-nextmonth")); + + // Click and hold left mouse button to start fast forwarding. + new Actions(driver).clickAndHold(nextMonthButton).perform(); + sleep(1000); + + // Right click and release the left button. + + new Actions(driver).contextClick(nextMonthButton) + .release(nextMonthButton).perform(); + + // Now the fast forwarding should be ended, get the expected month. + String expectedMonth = getSelectedMonth(); + + // Make browser context menu disappear, since it will crash IE + $(VerticalLayoutElement.class).first().click(); + + Assert.assertFalse("Month did not change during fast forward", + firstMonth.equals(expectedMonth)); + + // Wait for a while. + Thread.sleep(1000); + + // Verify that we didn't fast forward any further after the left button + // was released. + String actualMonth = getSelectedMonth(); + assertEquals(expectedMonth, actualMonth); + } + + private String getSelectedMonth() { + return driver.findElement( + By.className("v-inline-datefield-calendarpanel-month")) + .getText(); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java index 123fd167d0..5f659d389b 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -19,10 +19,10 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; -import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; +import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class DateFieldTestTest extends MultiBrowserTest { @@ -44,12 +44,8 @@ public class DateFieldTestTest extends MultiBrowserTest { } private void assertNoErrorNotification() { - try { - getDriver().findElement( - By.xpath("//div[contains(@class, 'v-Notification') ]")); - Assert.fail("Error notification shown!"); - } catch (NoSuchElementException e) { - // As expected + if (isElementPresent(NotificationElement.class)) { + Assert.fail("Notification was present"); } } @@ -122,4 +118,4 @@ public class DateFieldTestTest extends MultiBrowserTest { } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java index c48d2383a7..49590a3cee 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -19,11 +19,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.DateField; -/** - * - * @since 7.1 - * @author Vaadin Ltd - */ public class DisabledDateFieldPopup extends AbstractTestUI { @Override diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java index dc287c19da..a57017746a 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -15,38 +15,44 @@ */ package com.vaadin.tests.components.datefield; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.tests.tb3.MultiBrowserTest; -/** - * - * @since 7.1 - * @author Vaadin Ltd - */ public class DisabledDateFieldPopupTest extends MultiBrowserTest { + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(); + for (DesiredCapabilities browser : super.getBrowsersToTest()) { + if (BrowserUtil.isIE(browser)) { + browsers.add(browser); + } + } + return browsers; + } + @Test - public void testPopup() { + public void testPopup() throws IOException { openTestURL(); WebElement button = driver.findElement(By .className("v-datefield-button")); - button.click(); + new Actions(driver).moveToElement(button).click() + .sendKeys(Keys.ARROW_DOWN).perform(); Assert.assertFalse( - "Calendar popup should not be opened for disabled date field on mouse click", + "Calendar popup should not be opened for disabled date field", isElementPresent(By.className("v-datefield-popup"))); - - button.sendKeys(Keys.ARROW_DOWN); - - Assert.assertFalse("Calendar popup should not be opened for " - + "disabled date fild on down key", - isElementPresent(By.className("v-datefield-popup"))); - } } diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateField.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateField.java new file mode 100644 index 0000000000..affc5d322c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateField.java @@ -0,0 +1,58 @@ +/* + * 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.components.datefield; + +import java.util.Calendar; +import java.util.Date; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; +import com.vaadin.ui.InlineDateField; + +public class DisabledInlineDateField extends AbstractTestUI { + + private static final Date testDate; + static { + Calendar cal = Calendar.getInstance(); + cal.set(2014, 5, 5); + testDate = cal.getTime(); + } + + @Override + protected void setup(VaadinRequest request) { + DateField df = new InlineDateField("Disabled"); + df.setValue(testDate); + df.setEnabled(false); + addComponent(df); + + df = new InlineDateField("Read-only"); + df.setValue(testDate); + df.setReadOnly(true); + addComponent(df); + } + + @Override + protected String getTestDescription() { + return "Testing disabled and read-only modes of InlineDateField."; + } + + @Override + protected Integer getTicketNumber() { + return 10262; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateFieldTest.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateFieldTest.java new file mode 100644 index 0000000000..2c50030461 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledInlineDateFieldTest.java @@ -0,0 +1,79 @@ +/* + * 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.components.datefield; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DisabledInlineDateFieldTest extends MultiBrowserTest { + + @Test + public void testDisabled() { + openTestURL(); + testNextMonthControls(".v-disabled"); + testDaySelection(".v-disabled"); + } + + @Test + public void testReadOnly() { + openTestURL(); + testNextMonthControls(".v-readonly"); + testDaySelection(".v-readonly"); + } + + private void testNextMonthControls(String cssClass) { + // Get the currently selected month. + String expectedMonth = getSelectedMonth(cssClass); + + // Attempt to click the next month button. + driver.findElement(By.cssSelector(cssClass + " .v-button-nextmonth")) + .click(); + + // Assert that we did not navigate to next month. + String actualMonth = getSelectedMonth(cssClass); + assertEquals(expectedMonth, actualMonth); + } + + private void testDaySelection(String cssClass) { + // We know that the first day element is not selected, because of the + // fixed date in the test. + WebElement nonSelectedDay = driver.findElement(By.cssSelector(cssClass + + " .v-inline-datefield-calendarpanel-day")); + + // Assert it is not selected before click. + assertFalse(nonSelectedDay.getAttribute("class").contains("selected")); + + // Click on the non-selected day. + nonSelectedDay.click(); + + // Assert that clicking did not select the day. + assertFalse(nonSelectedDay.getAttribute("class").contains("selected")); + } + + private String getSelectedMonth(String selectorPrefix) { + return driver.findElement( + By.cssSelector(selectorPrefix + + " .v-inline-datefield-calendarpanel-month")) + .getText(); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayout.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayout.java index cf09ff029d..49d88630a8 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayout.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayout.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -35,7 +35,6 @@ public class DisabledParentLayout extends AbstractTestUI { content.setMargin(true); final VerticalLayout pane = new VerticalLayout(); - pane.setEnabled(false); pane.addComponent(new DateField()); content.addComponent(pane); @@ -44,7 +43,7 @@ public class DisabledParentLayout extends AbstractTestUI { button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { - pane.setEnabled(true); + pane.setEnabled(!pane.isEnabled()); } }); content.addComponent(button); diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java index 3ee4544693..76486bf340 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledParentLayoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -35,17 +35,41 @@ public class DisabledParentLayoutTest extends MultiBrowserTest { WebElement button = driver.findElement(By.className("v-button")); button.click(); + WebElement textField = driver.findElement(By + .className("v-datefield-textfield")); + textField.click(); + + Assert.assertFalse( + "Date input text field shoud be disabled for disabled DateField", + textField.isEnabled()); + WebElement dataFieldButton = driver.findElement(By .className("v-datefield-button")); dataFieldButton.click(); - WebElement popup = driver - .findElement(By.className("v-datefield-popup")); + Assert.assertFalse( + "Disabled date popup is opened after click to its button", + isElementPresent(By.className("v-datefield-popup"))); + + button.click(); + + Assert.assertTrue( + "Date input text field shoud be enabled for enabled DateField", + textField.isEnabled()); + textField.click(); + String text = "text"; + textField.sendKeys(text); + + Assert.assertEquals("Unexpected text in date text field", text, + textField.getAttribute("value")); + + dataFieldButton.click(); Assert.assertFalse("Unexpected disabled element found", isElementPresent(By.className("v-disabled"))); - Assert.assertNotNull( - "Date popup is not opened after click to its button", popup); + Assert.assertTrue("Date popup is not opened after click to its button", + isElementPresent(By.className("v-datefield-popup"))); } + } diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java index fb0fb2a546..31f97afabd 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java @@ -90,4 +90,4 @@ public class DynamicallyChangeDateRange extends AbstractTestUI { return 11940; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java b/uitest/src/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java index dab47ebdd9..b77b782d2a 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java +++ b/uitest/src/com/vaadin/tests/components/datefield/NarrowPopupDateFieldInTable.java @@ -31,4 +31,4 @@ public class NarrowPopupDateFieldInTable extends TestBase { return 6166; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java index f1422b28a3..0b8ffa52fa 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEsc.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java index 834517e1bb..1366d38705 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupClosingWithEscTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java index f12a3dda58..86ce195609 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldLocaleTest.java @@ -50,4 +50,4 @@ public class PopupDateFieldLocaleTest extends AbstractTestUI { return 12135; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java index 5a6f6517bd..ede5510c72 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldPopup.java @@ -38,4 +38,4 @@ public class PopupDateFieldPopup extends TestBase { return 8391; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java index 1ba6409a6f..130ed8f3c5 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java @@ -41,4 +41,4 @@ public class PopupDateFieldTextEnabled extends TestBase { return 6790; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java index b875d86428..b6cc002872 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropBatchUpload.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropBatchUpload.java index adb5cd9e3a..b820ccf788 100644 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropBatchUpload.java +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropBatchUpload.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextArea.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextArea.java new file mode 100644 index 0000000000..2ce3a42957 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextArea.java @@ -0,0 +1,56 @@ +/* + * Copyright 2000-2013 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.components.draganddropwrapper; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.DragAndDropWrapper.DragStartMode; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.VerticalLayout; + +/** + * Test UI for text area: drag image should contain text-area text. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class DragAndDropTextArea extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + VerticalLayout dndLayout = new VerticalLayout(); + + TextArea area = new TextArea(); + area.setValue("text"); + + dndLayout.addComponent(area); + DragAndDropWrapper wrapper = new DragAndDropWrapper(dndLayout); + wrapper.setDragStartMode(DragStartMode.WRAPPER); + addComponent(wrapper); + } + + @Override + protected String getTestDescription() { + return "Drag image for textarea should contain text-area text"; + } + + @Override + protected Integer getTicketNumber() { + return 13557; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java new file mode 100644 index 0000000000..c60eead918 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropTextAreaTest.java @@ -0,0 +1,61 @@ +/* + * Copyright 2000-2013 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.components.draganddropwrapper; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for drag image of text area which should contain text-area text. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class DragAndDropTextAreaTest extends MultiBrowserTest { + + @Test + public void testTextAreaDndImage() { + openTestURL(); + + WebElement wrapper = driver.findElement(By + .className("v-verticallayout")); + Actions actions = new Actions(driver); + actions.clickAndHold(wrapper); + actions.moveByOffset(50, 50); + actions.perform(); + + WebElement dragElement = driver.findElement(By + .className("v-drag-element")); + List<WebElement> children = dragElement.findElements(By.xpath(".//*")); + boolean found = false; + for (WebElement child : children) { + if ("text".equals(child.getAttribute("value"))) { + found = true; + } + } + + Assert.assertTrue( + "Text value is not found in the DnD image of text area", found); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.html deleted file mode 100644 index 3e7a7cb0a7..0000000000 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.html +++ /dev/null @@ -1,62 +0,0 @@ -<?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>DragStartModes</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">DragStartModes</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.draganddropwrapper.DragStartModes?restartApplication</td> - <td></td> -</tr> -<tr> - <td>drag</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::PID_SlabelCOMPONENT</td> - <td>50,10</td> -</tr> -<tr> - <td>mouseMoveAt</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VLabel[0]</td> - <td>50,10</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>drag-mode-component</td> -</tr> -<tr> - <td>drop</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VLabel[0]</td> - <td>50,10</td> -</tr> -<tr> - <td>drag</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::PID_SlabelWRAPPER</td> - <td>50,10</td> -</tr> -<tr> - <td>mouseMoveAt</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VLabel[0]</td> - <td>50,10</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>drag-mode-wrapper</td> -</tr> -<tr> - <td>drop</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragStartModes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VLabel[0]</td> - <td>50,10</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java new file mode 100644 index 0000000000..25aef1b815 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java @@ -0,0 +1,46 @@ +/* + * 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.components.draganddropwrapper; + +import java.io.IOException; + +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DragStartModesTest extends MultiBrowserTest { + + @Test + public void testDragStartModes() throws IOException { + openTestURL(); + WebElement dropTarget = vaadinElement("/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]"); + dragToTarget("COMPONENT", dropTarget); + dragToTarget("WRAPPER", dropTarget); + } + + private void dragToTarget(String dragMode, WebElement dropTarget) + throws IOException { + WebElement draggable = vaadinElementById("label" + dragMode); + new Actions(driver).moveToElement(draggable, 10, 10).clickAndHold() + .moveByOffset(5, 0).perform(); + new Actions(driver).moveToElement(dropTarget, 12, 10).perform(); + compareScreen("dragMode" + dragMode); + new Actions(driver).release().perform(); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java index ce9067df29..a7fd9956e3 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/CaptionEnableDisable.java @@ -58,4 +58,4 @@ public class CaptionEnableDisable extends AbstractTestUI { return 12062; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java b/uitest/src/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java index 3296906762..d3932c1df0 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/formlayout/FormLayouts.java b/uitest/src/com/vaadin/tests/components/formlayout/FormLayouts.java index 46b2f0148c..6b17c557da 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/FormLayouts.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/FormLayouts.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/formlayout/StylePrefix.java b/uitest/src/com/vaadin/tests/components/formlayout/StylePrefix.java new file mode 100644 index 0000000000..8ca88fbcd3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/StylePrefix.java @@ -0,0 +1,47 @@ +/* + * 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.components.formlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.FormLayout; + +/** + * Test UI for FormLayout: custom additional styles should be prefixed with + * "v-formlayout-", not "v-layout-". + * + * @author Vaadin Ltd + */ +public class StylePrefix extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + FormLayout layout = new FormLayout(); + layout.addStyleName("mystyle"); + addComponent(layout); + } + + @Override + protected String getTestDescription() { + return "Form layout should set v-formlayout style name instead of v-layout"; + } + + @Override + protected Integer getTicketNumber() { + return 13509; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/formlayout/StylePrefixTest.java b/uitest/src/com/vaadin/tests/components/formlayout/StylePrefixTest.java new file mode 100644 index 0000000000..c43dc0042e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/StylePrefixTest.java @@ -0,0 +1,40 @@ +/* + * 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.components.formlayout; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for FormLayout style prefix: custom additional styles should be prefixed + * with "v-formlayout-", not "v-layout-". + * + * @author Vaadin Ltd + */ +public class StylePrefixTest extends MultiBrowserTest { + + @Test + public void testStylePrefix() { + openTestURL(); + + Assert.assertTrue("Custom style has unexpected prefix", + isElementPresent(By.className("v-formlayout-mystyle"))); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java index ce405a8eff..3978c49b09 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java @@ -42,4 +42,4 @@ public class TableInFormLayoutCausesScrolling extends AbstractTestCase { protected Integer getTicketNumber() { return 7309; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java new file mode 100644 index 0000000000..9bc29b5c82 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java @@ -0,0 +1,78 @@ +/* + * 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.components.gridlayout; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; + +public class GridLayoutScrollPosition extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + + Panel panel = new Panel(); + setContent(panel); + + GridLayout gridLayout = new GridLayout(); + gridLayout.setWidth("500px"); + panel.setContent(gridLayout); + gridLayout.setColumns(1); + gridLayout.setRows(1); + + Label dummyLabel = new Label("Dummy"); + dummyLabel.setHeight("500px"); + gridLayout.addComponent(dummyLabel); + + final CheckBox visibilityToggleCheckBox = new CheckBox( + "Hide / Show toggleable components"); + visibilityToggleCheckBox.setId("visibility-toggle"); + visibilityToggleCheckBox.setHeight("2000px"); + visibilityToggleCheckBox.setImmediate(true); + visibilityToggleCheckBox.setValue(false); // Initially unchecked + gridLayout.addComponent(visibilityToggleCheckBox); + + final Label toggleableLabel = new Label("Toggleable Label"); + toggleableLabel.setHeight("2000px"); + toggleableLabel.setVisible(false); // Initially hidden + gridLayout.addComponent(toggleableLabel); + + visibilityToggleCheckBox + .addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + toggleableLabel.setVisible(visibilityToggleCheckBox + .getValue()); + } + }); + + } + + @Override + protected String getTestDescription() { + return "The UI scroll position should not be reset when visibility of GridLayout children is toggled"; + } + + @Override + protected Integer getTicketNumber() { + return 13386; + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPositionTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPositionTest.java new file mode 100644 index 0000000000..961b08002b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutScrollPositionTest.java @@ -0,0 +1,48 @@ +/* + * 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.components.gridlayout; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridLayoutScrollPositionTest extends MultiBrowserTest { + + @Test + public void testToggleChildComponents() throws Exception { + + final int SCROLLTOP = 100; + + openTestURL(); + + WebDriver driver = getDriver(); + + WebElement ui = driver.findElement(By.className("v-ui")); + + testBenchElement(ui).scroll(SCROLLTOP); + + driver.findElement(By.id("visibility-toggle")) + .findElement(By.tagName("input")).click(); + + assertEquals("UI scroll position", String.valueOf(SCROLLTOP), + ui.getAttribute("scrollTop")); + } +} diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java index 8312b15ba7..6cc96332d5 100644 --- a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java +++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java @@ -50,4 +50,4 @@ public class GridLayoutWithNonIntegerWidth extends AbstractTestUI { protected Integer getTicketNumber() { return 11775; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java b/uitest/src/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java index dc04e23f02..0ec8cd5030 100644 --- a/uitest/src/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java +++ b/uitest/src/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java b/uitest/src/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java index b99f67b82e..5a64cb6a00 100644 --- a/uitest/src/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java +++ b/uitest/src/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java index 9d0094b833..b9071ec44c 100644 --- a/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java +++ b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/label/LabelModesTest.java b/uitest/src/com/vaadin/tests/components/label/LabelModesTest.java index efad615510..7314ce4093 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelModesTest.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelModesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -27,4 +27,4 @@ public class LabelModesTest extends MultiBrowserTest { compareScreen("labelmodes"); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java index c1965ff92b..876d56208b 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java @@ -55,4 +55,4 @@ public class LabelPropertySourceValue extends AbstractTestUI { return 9618; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/label/LabelStyles.java b/uitest/src/com/vaadin/tests/components/label/LabelStyles.java index 7c26ec1a2e..6de50b0cba 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelStyles.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelStyles.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/link/LinkTest.java b/uitest/src/com/vaadin/tests/components/link/LinkTest.java index b18e51ed4c..6deea0fd96 100644 --- a/uitest/src/com/vaadin/tests/components/link/LinkTest.java +++ b/uitest/src/com/vaadin/tests/components/link/LinkTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/media/AudioTest.java b/uitest/src/com/vaadin/tests/components/media/AudioTest.java index 28d1a7716f..c77583096d 100644 --- a/uitest/src/com/vaadin/tests/components/media/AudioTest.java +++ b/uitest/src/com/vaadin/tests/components/media/AudioTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/media/Media.java b/uitest/src/com/vaadin/tests/components/media/Media.java index bd038a5d42..5ccf9eb72b 100644 --- a/uitest/src/com/vaadin/tests/components/media/Media.java +++ b/uitest/src/com/vaadin/tests/components/media/Media.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java index 2ea7a23333..2613634576 100644 --- a/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuBarFocus.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigation.java b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigation.java index 338219d848..764844751c 100644 --- a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigation.java +++ b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java index f10e1551df..3e0053d0d1 100644 --- a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java +++ b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndText.java b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndText.java index fdeed316ba..d1a889dcf4 100644 --- a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndText.java +++ b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndText.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java index 2cb294de77..37987171d2 100644 --- a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java +++ b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonIconAndTextTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java index e038c451d0..eb838c135e 100644 --- a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java +++ b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPosition.java b/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPosition.java index 4050e4505e..b770435161 100644 --- a/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPosition.java +++ b/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPosition.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java b/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java index 9f31719a10..dc43b9d19a 100644 --- a/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java +++ b/uitest/src/com/vaadin/tests/components/notification/MiddleNotificationPositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java index 27af49a397..ecf704835f 100644 --- a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java +++ b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.notification; import com.vaadin.data.Item; import com.vaadin.server.Page; -import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role; +import com.vaadin.shared.ui.ui.NotificationRole; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -11,8 +11,10 @@ import com.vaadin.ui.ComboBox; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.Notification; import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.NotificationConfiguration; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; +import com.vaadin.ui.UI; public class NotificationsWaiAria extends TestBase { @@ -36,9 +38,9 @@ public class NotificationsWaiAria extends TestBase { " - closes automatically after 10 seconds"); addComponent(postfix); - role = new NativeSelect("Role"); - role.addItem(Role.ALERT); - role.addItem(Role.STATUS); + role = new NativeSelect("NotificationRole"); + role.addItem(NotificationRole.ALERT); + role.addItem(NotificationRole.STATUS); role.setValue(role.getItemIds().iterator().next()); addComponent(role); @@ -96,9 +98,12 @@ public class NotificationsWaiAria extends TestBase { Notification n = new Notification(tf.getValue(), typeValue); n.setHtmlContentAllowed(true); - n.setAssistivePrefixForType(typeValue, prefix.getValue()); - n.setAssistivePostfixForType(typeValue, postfix.getValue()); - n.setAssistiveRoleForType(typeValue, (Role) role.getValue()); + NotificationConfiguration notificationConf = UI.getCurrent() + .getNotificationConfiguration(); + notificationConf.setAssistivePrefix(typeValue, prefix.getValue()); + notificationConf.setAssistivePostfix(typeValue, postfix.getValue()); + notificationConf + .setAssistiveRole(typeValue, (NotificationRole) role.getValue()); n.show(Page.getCurrent()); } diff --git a/uitest/src/com/vaadin/tests/components/optiongroup/OptionGroupRetainFocusKeyboardValueChange.java b/uitest/src/com/vaadin/tests/components/optiongroup/OptionGroupRetainFocusKeyboardValueChange.java index 570a300cb3..bad9723539 100644 --- a/uitest/src/com/vaadin/tests/components/optiongroup/OptionGroupRetainFocusKeyboardValueChange.java +++ b/uitest/src/com/vaadin/tests/components/optiongroup/OptionGroupRetainFocusKeyboardValueChange.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java index ba5701e699..4f7a939ee5 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java @@ -480,4 +480,4 @@ public class BoxLayoutTest extends AbstractTestUI { return null; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java index 142ca00ba7..0fbd0e5f69 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -26,6 +26,7 @@ public class CaptionLeakTest extends MultiBrowserTest { public void testCaptionLeak() throws Exception { setDebug(true); openTestURL(); + openDebugLogTab(); // this should be present // 3 general non-connector elements, none accumulated on click @@ -54,6 +55,7 @@ public class CaptionLeakTest extends MultiBrowserTest { public void testNoCaptionLeak() throws Exception { setDebug(true); openTestURL(); + openDebugLogTab(); getDriver().findElement(By.xpath("//button[@title = 'Clear log']")) .click(); diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.html b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.html deleted file mode 100644 index 81da3b897e..0000000000 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.html +++ /dev/null @@ -1,82 +0,0 @@ -<?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>Required error tootlip</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">Required error tooltip</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.orderedlayout.ErrorIndicator?restartApplication</td> - <td></td> -</tr> -<tr> - <td>showTooltip</td> - <td>//div[@id='gwt-uid-4']/span</td> - <td>43,4</td> -</tr> - -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltipVertivcalCaption</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>showTooltip</td> - <td>//div[@id='gwt-uid-4']/span[2]</td> - <td>3,6</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltipVertivcalRequiredIndicator</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>showTooltip</td> - <td>//div[@id='gwt-uid-6']/span</td> - <td>38,11</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltipHorizontalCaption</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>showTooltip</td> - <td>//div[@id='gwt-uid-6']/span[2]</td> - <td>3,4</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltipHorizontalRequiredIndicator</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java index 9964e1ee78..def67c256a 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java new file mode 100644 index 0000000000..0367a77c7e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java @@ -0,0 +1,41 @@ +/* + * 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.components.orderedlayout; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ErrorIndicatorTest extends MultiBrowserTest { + + @Test + public void verifyTooltips() { + String tooltipText; + openTestURL(); + + $(TextFieldElement.class).first().showTooltip(); + tooltipText = driver.findElement(By.className("v-tooltip")).getText(); + assertEquals(tooltipText, "Vertical layout tooltip"); + + $(TextFieldElement.class).get(1).showTooltip(); + tooltipText = driver.findElement(By.className("v-tooltip")).getText(); + assertEquals(tooltipText, "Horizontal layout tooltip"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java index 24ebf24688..ea78d9f30c 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutFullsizeContentWithErrorMsgTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -46,4 +46,4 @@ public class HorizontalLayoutFullsizeContentWithErrorMsgTest extends } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutTest.java index fd6ecf5422..d9ab760302 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/HorizontalLayoutTest.java @@ -11,4 +11,4 @@ public class HorizontalLayoutTest extends return HorizontalLayout.class; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/InsertComponentInHorizontalLayout.java b/uitest/src/com/vaadin/tests/components/orderedlayout/InsertComponentInHorizontalLayout.java index 99896fcd81..ae26706d35 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/InsertComponentInHorizontalLayout.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/InsertComponentInHorizontalLayout.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java index e9b022eac2..59e2b0936a 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java index 24a27f343a..1cddbc28c3 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/RelativeChildrenWithoutExpand.java b/uitest/src/com/vaadin/tests/components/orderedlayout/RelativeChildrenWithoutExpand.java index a1ac1df307..59447919ef 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/RelativeChildrenWithoutExpand.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/RelativeChildrenWithoutExpand.java @@ -52,4 +52,4 @@ public class RelativeChildrenWithoutExpand extends AbstractTestUI { protected Integer getTicketNumber() { return Integer.valueOf(10222); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/SpacingLeakTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/SpacingLeakTest.java index 3a24cb7620..565c11c1f0 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/SpacingLeakTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/SpacingLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -26,6 +26,7 @@ public class SpacingLeakTest extends MultiBrowserTest { public void testSpacingLeak() throws Exception { setDebug(true); openTestURL(); + openDebugLogTab(); getDriver().findElement(By.id("addbutton")).click(); getDriver().findElement(By.xpath("//button[@title = 'Clear log']")) .click(); diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java index fcc9792a7d..15f964f110 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java @@ -344,4 +344,4 @@ public class VaadinTunesLayout extends AbstractTestUI { return null; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java index 1e7d817094..d55765b5e4 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java index 14c26a0e17..1afcabec1d 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/page/PageTitle.java b/uitest/src/com/vaadin/tests/components/page/PageTitle.java index 38dcd4673c..3979ede8c8 100644 --- a/uitest/src/com/vaadin/tests/components/page/PageTitle.java +++ b/uitest/src/com/vaadin/tests/components/page/PageTitle.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/page/PageTitleTest.java b/uitest/src/com/vaadin/tests/components/page/PageTitleTest.java index 039f52be73..bc2e6f7ca1 100644 --- a/uitest/src/com/vaadin/tests/components/page/PageTitleTest.java +++ b/uitest/src/com/vaadin/tests/components/page/PageTitleTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelChangeContents.java b/uitest/src/com/vaadin/tests/components/panel/PanelChangeContents.java index 1b621e3a4f..3f953bf73a 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelChangeContents.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelChangeContents.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelChangeContentsTest.java b/uitest/src/com/vaadin/tests/components/panel/PanelChangeContentsTest.java index 5bc505dbc8..039b054040 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelChangeContentsTest.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelChangeContentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/panel/WebkitScrollbarTest.java b/uitest/src/com/vaadin/tests/components/panel/WebkitScrollbarTest.java index 8981f52f12..2c4bac03b0 100644 --- a/uitest/src/com/vaadin/tests/components/panel/WebkitScrollbarTest.java +++ b/uitest/src/com/vaadin/tests/components/panel/WebkitScrollbarTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.html b/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.html deleted file mode 100644 index 28af578bac..0000000000 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.html +++ /dev/null @@ -1,32 +0,0 @@ -<?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://localhost:8888/" /> -<title>PopupViewAndFragment</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">PopupViewAndFragment</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/PopupViewAndFragment?restartApplication#</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runPopupViewAndFragment::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.java index 1606b78604..8178cfdbe2 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.java +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragment.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragmentTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragmentTest.java new file mode 100644 index 0000000000..510cc7c883 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewAndFragmentTest.java @@ -0,0 +1,33 @@ +/* + * 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.components.popupview; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class PopupViewAndFragmentTest extends MultiBrowserTest { + + @Test + public void changeFragmentAndOpenPopupView() throws Exception { + openTestURL(); + $(ButtonElement.class).first().click(); + // Wait for popup view to fully open + sleep(1000); + compareScreen("changedFragment"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaption.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaption.java index 8cb9f01d93..2bf587ba97 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaption.java +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaption.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java index 9c59e2ca6e..f9b1692b85 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewCaptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java new file mode 100644 index 0000000000..cf3854ee69 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpen.java @@ -0,0 +1,73 @@ +/* + * 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.components.popupview; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Component; +import com.vaadin.ui.PopupView; +import com.vaadin.ui.VerticalLayout; + +/** + * Resizing PopupView's popup component while it is visible should also resize + * the drop shadow of the overlay. + * + * @author Vaadin Ltd + */ +public class PopupViewResizeWhileOpen extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + PopupView pv = new PopupView(new PopupView.Content() { + @Override + public Component getPopupComponent() { + final VerticalLayout popupComponent = new VerticalLayout(); + popupComponent.setId("content-vl"); + popupComponent.setWidth("640px"); + popupComponent.setHeight("480px"); + + Button button = new Button("Change height!", + new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + popupComponent.setHeight("320px"); + } + }); + + popupComponent.addComponent(button); + return popupComponent; + } + + @Override + public String getMinimizedValueAsHTML() { + return "Click me!"; + } + }); + pv.setHideOnMouseOut(false); + addComponent(pv); + } + + @Override + protected String getTestDescription() { + return "Resize PopupView's content component while visible"; + } + + @Override + protected Integer getTicketNumber() { + return 13666; + } +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java new file mode 100644 index 0000000000..52ffc6b729 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java @@ -0,0 +1,70 @@ +/* + * 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.components.popupview; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.lessThan; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.PopupViewElement; +import com.vaadin.testbench.elements.VerticalLayoutElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Resizing PopupView's popup component while it is visible should also resize + * the drop shadow of the overlay. + * + * @author Vaadin Ltd + */ +public class PopupViewResizeWhileOpenTest extends MultiBrowserTest { + + @Test + public void testCustomPopupSizeAfterResize() { + openTestURL(); + + // Open PopupView + $(PopupViewElement.class).first().click(); + + // Shadow element + WebElement shadow = findElement(By.className("v-shadow")); + WebElement vl = $(VerticalLayoutElement.class).id("content-vl"); + + // Sanity check + assertShadowSize(vl, shadow); + + // Resize + $(ButtonElement.class).first().click(); + assertShadowSize(vl, shadow); + } + + private void assertShadowSize(WebElement layout, WebElement shadow) { + Dimension shadowSize = shadow.getSize(); + Dimension layoutSize = layout.getSize(); + + assertThat(shadowSize.height, is(greaterThan(layoutSize.height))); + assertThat(shadowSize.height, is(lessThan(layoutSize.height + 10))); + assertThat(shadowSize.width, is(greaterThan(layoutSize.width))); + assertThat(shadowSize.width, is(lessThan(layoutSize.width + 10))); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java new file mode 100644 index 0000000000..04bbf6df0a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtension.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2013 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.components.popupview; + +import com.vaadin.server.Responsive; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.PopupView; + +/** + * Test UI for popup view with extension: extension is a part of getChildren() + * collection but is not inside the getChildComponents() collection. Popup view + * should use getChildComponents() to avoid exception when extension is returned + * by getChildren(). + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class PopupViewWithExtension extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Label label = new Label("label"); + PopupView view = new PopupView("small", label); + + Responsive.makeResponsive(view); + + addComponent(view); + } + + @Override + protected String getTestDescription() { + return "PopupView should use getChildComponents() in the connector, not getChildren()"; + } + + @Override + protected Integer getTicketNumber() { + return 13503; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java new file mode 100644 index 0000000000..4d11190ea9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithExtensionTest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2013 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.components.popupview; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Popup view with extension should not throw an exception. + * + * @since 7.2 + * @author Vaadin Ltd + */ +public class PopupViewWithExtensionTest extends MultiBrowserTest { + + @Test + public void testPopupView() { + setDebug(true); + openTestURL(); + + WebElement view = driver.findElement(By.className("v-popupview")); + view.click(); + + Assert.assertFalse( + "Popup view with extension should not throw an exception. " + + "(Error notification window is shown).", + isElementPresent(By.className("v-Notification-error"))); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/popupview/ReopenPopupView.java b/uitest/src/com/vaadin/tests/components/popupview/ReopenPopupView.java index fd83fc797c..979bafc688 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/ReopenPopupView.java +++ b/uitest/src/com/vaadin/tests/components/popupview/ReopenPopupView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java index 5afa874220..ce51184e7d 100644 --- a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java index 93e8c6d8f2..5b3a931e5b 100644 --- a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java index 0df82688d1..2f58e35dc7 100644 --- a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java +++ b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java @@ -103,4 +103,4 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout> select.setImmediate(true); return select; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java index de068ed230..458bfda6fa 100644 --- a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java +++ b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderDisable.java b/uitest/src/com/vaadin/tests/components/slider/SliderDisable.java index bd1d175119..a15e0d95ae 100644 --- a/uitest/src/com/vaadin/tests/components/slider/SliderDisable.java +++ b/uitest/src/com/vaadin/tests/components/slider/SliderDisable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java index 923d0f46ab..12d26b8f8f 100644 --- a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java +++ b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -62,4 +62,4 @@ public class SliderDisableTest extends MultiBrowserTest { return handle.getCssValue("margin-left"); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java index 21b56b7972..89f834a42f 100644 --- a/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java +++ b/uitest/src/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelInModalWindow.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelInModalWindow.java index a1d0fcb42b..67ac15ce81 100644 --- a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelInModalWindow.java +++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelInModalWindow.java @@ -33,4 +33,4 @@ public class SplitPanelInModalWindow extends TestBase { return 4067; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/AddNonRenderedRow.java b/uitest/src/com/vaadin/tests/components/table/AddNonRenderedRow.java index 80b136d2ab..741c5f6cec 100644 --- a/uitest/src/com/vaadin/tests/components/table/AddNonRenderedRow.java +++ b/uitest/src/com/vaadin/tests/components/table/AddNonRenderedRow.java @@ -46,4 +46,4 @@ public class AddNonRenderedRow extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(8077); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRange.java b/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRange.java index 104380c96c..2d8a30cb12 100644 --- a/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRange.java +++ b/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRange.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java b/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java index f6a503db72..897511e41a 100644 --- a/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java +++ b/uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdates.java b/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdates.java new file mode 100644 index 0000000000..fcbfe1e0b0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdates.java @@ -0,0 +1,126 @@ +/* + * Copyright 2000-2013 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.components.table; + +import javax.servlet.annotation.WebServlet; + +import com.vaadin.annotations.Push; +import com.vaadin.annotations.VaadinServletConfiguration; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinServlet; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Table; + +/** + * Test to see if VScrollTable handles Push updates correctly. + * + * @author Vaadin Ltd + */ +@Push +public class AsyncPushUpdates extends AbstractTestUI { + + public int clickCount = 0; + + @WebServlet(value = "/*", asyncSupported = true) + @VaadinServletConfiguration(productionMode = false, ui = AsyncPushUpdates.class) + public static class Servlet extends VaadinServlet { + } + + public static final String VALUE_PROPERTY_ID = "value"; + + private final IndexedContainer container = createContainer(); + private final Table table = new Table(); + + @Override + public void setup(VaadinRequest request) { + table.setWidth("100%"); + table.setContainerDataSource(container); + + Button button = new Button("START"); + button.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + ++clickCount; + + container.removeAllItems(); + for (int i = 0; i < 100; i++) { + container.getContainerProperty(container.addItem(), + VALUE_PROPERTY_ID).setValue("A" + i); + } + + Runnable generateNewRows = new Runnable() { + public int id = 0; + + @Override + public void run() { + getSession().lock(); + try { + Thread.sleep(500); + ++id; + container.removeAllItems(); + for (int i = 0; i < 11; i++) { + container.getContainerProperty( + container.addItem(), VALUE_PROPERTY_ID) + .setValue( + clickCount + " - " + id + " - " + + i); + } + + } catch (InterruptedException e) { + // NOOP + } finally { + getSession().unlock(); + } + } + }; + new Thread(generateNewRows).start(); + } + }); + addComponent(table); + addComponent(button); + } + + private static IndexedContainer createContainer() { + IndexedContainer container = new IndexedContainer(); + container.addContainerProperty(VALUE_PROPERTY_ID, String.class, ""); + return container; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Make sure there are no duplicates on the table."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 13562; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java b/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java new file mode 100644 index 0000000000..b33204cc44 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/AsyncPushUpdatesTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test to see if VScrollTable handles Push updates correctly. + * + * @author Vaadin Ltd + */ +public class AsyncPushUpdatesTest extends MultiBrowserTest { + + @Test(expected = NoSuchElementException.class) + public void InsertedRowsAreNotDuplicated() { + openTestURL(); + + WebElement button = $(ButtonElement.class).first(); + + button.click(); + + $(TableElement.class).first().getCell(12, 0); + Assert.fail("Duplicates are present."); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeDuringTablePaint.java b/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeDuringTablePaint.java index 0f385176bf..12f28332f4 100644 --- a/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeDuringTablePaint.java +++ b/uitest/src/com/vaadin/tests/components/table/ContainerSizeChangeDuringTablePaint.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/CtrlShiftMultiselectTest.java b/uitest/src/com/vaadin/tests/components/table/CtrlShiftMultiselectTest.java new file mode 100644 index 0000000000..255a798594 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/CtrlShiftMultiselectTest.java @@ -0,0 +1,80 @@ +/* + * 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.components.table; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class CtrlShiftMultiselectTest extends MultiBrowserTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsers = super.getBrowsersToTest(); + // Shift + click doesn't select all rows correctly on these browsers + browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); + browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); + + return browsers; + } + + @Override + protected DesiredCapabilities getDesiredCapabilities() { + DesiredCapabilities cap = new DesiredCapabilities( + super.getDesiredCapabilities()); + cap.setCapability("requireWindowFocus", true); + return cap; + } + + @Test + public void testSelectionRangeDragging() throws IOException { + openTestURL(); + clickRow(3); + new Actions(driver).keyDown(Keys.SHIFT).perform(); + clickRow(8); + new Actions(driver).keyUp(Keys.SHIFT).perform(); + dragRows(5, 700, 0); + compareScreen("draggedMultipleRows"); + new Actions(driver).release().perform(); + } + + private void clickRow(int index) { + List<WebElement> rows = getAllRows(); + rows.get(index).click(); + } + + private void dragRows(int dragIdx, int xOffset, int yOffset) { + List<WebElement> rows = getAllRows(); + new Actions(driver).moveToElement(rows.get(dragIdx)).clickAndHold() + .moveByOffset(5, 0).perform(); + new Actions(driver).moveByOffset(xOffset - 5, yOffset).perform(); + + } + + private List<WebElement> getAllRows() { + WebElement table = vaadinElement("/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]"); + return table.findElements(By.cssSelector(".v-table-table tr")); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/DndEmptyTable.java b/uitest/src/com/vaadin/tests/components/table/DndEmptyTable.java new file mode 100644 index 0000000000..baac7ce057 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/DndEmptyTable.java @@ -0,0 +1,71 @@ +/* + * Copyright 2000-2013 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.components.table; + +import com.vaadin.event.dd.DragAndDropEvent; +import com.vaadin.event.dd.DropHandler; +import com.vaadin.event.dd.acceptcriteria.AcceptAll; +import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.DragAndDropWrapper.DragStartMode; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +/** + * Test UI for empty table: empty table (without any data) throws client side + * exception if it's a target for DnD. + * + * @since + * @author Vaadin Ltd + */ +public class DndEmptyTable extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Label source = new Label("label"); + DragAndDropWrapper wrapper = new DragAndDropWrapper(source); + wrapper.setDragStartMode(DragStartMode.WRAPPER); + addComponent(wrapper); + + Table target = new Table(); + target.setWidth(100, Unit.PERCENTAGE); + addComponent(target); + target.setDropHandler(new DropHandler() { + + @Override + public AcceptCriterion getAcceptCriterion() { + return AcceptAll.get(); + } + + @Override + public void drop(DragAndDropEvent event) { + } + }); + } + + @Override + protected String getTestDescription() { + return "Drag and drop into empty table should not throws client side exception."; + } + + @Override + protected Integer getTicketNumber() { + return 13655; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java b/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java new file mode 100644 index 0000000000..4c682637b1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/DndEmptyTableTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for empty table as a DnD target: it should not throws client side + * exception. + * + * @since + * @author Vaadin Ltd + */ +public class DndEmptyTableTest extends MultiBrowserTest { + + @Test + public void testDndEmptyTable() { + setDebug(true); + openTestURL(); + + WebElement source = driver.findElement(By.className("v-ddwrapper")); + WebElement target = driver.findElement(By.className("v-table-body")); + Actions actions = new Actions(driver); + actions.clickAndHold(source).moveToElement(target).release(); + + Assert.assertFalse(isElementPresent(By + .className("v-Notification-error"))); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java b/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java index 5db294088a..fa8ab8f0f5 100644 --- a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java +++ b/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java @@ -97,4 +97,4 @@ public class EditableModeChange extends TestBase { protected Integer getTicketNumber() { return 5427; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/EditableTableFocus.java b/uitest/src/com/vaadin/tests/components/table/EditableTableFocus.java index b5c8aa0296..7686549709 100644 --- a/uitest/src/com/vaadin/tests/components/table/EditableTableFocus.java +++ b/uitest/src/com/vaadin/tests/components/table/EditableTableFocus.java @@ -32,4 +32,4 @@ public class EditableTableFocus extends TestBase { protected Integer getTicketNumber() { return 7965; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyTable.java b/uitest/src/com/vaadin/tests/components/table/EmptyTable.java index d6c30efa5a..ad9c70444d 100644 --- a/uitest/src/com/vaadin/tests/components/table/EmptyTable.java +++ b/uitest/src/com/vaadin/tests/components/table/EmptyTable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java b/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java index 229dc23b9a..2332815ed6 100644 --- a/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java +++ b/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -17,9 +17,8 @@ package com.vaadin.tests.components.table; import org.junit.Assert; import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.NoSuchElementException; +import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class EmptyTableTest extends MultiBrowserTest { @@ -33,12 +32,9 @@ public class EmptyTableTest extends MultiBrowserTest { } private void ensureNoErrors() { - try { - getDriver().findElement(By.className("v-Notification")); - } catch (NoSuchElementException e) { - return; + if (isElementPresent(NotificationElement.class)) { + Assert.fail("Error notification was shown!"); } - Assert.fail("Error notification was shown!"); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java index 73dd7b1f81..1602f1bae5 100644 --- a/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java +++ b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/FixedHeightTable.java b/uitest/src/com/vaadin/tests/components/table/FixedHeightTable.java index 174c166320..22d6846dea 100644 --- a/uitest/src/com/vaadin/tests/components/table/FixedHeightTable.java +++ b/uitest/src/com/vaadin/tests/components/table/FixedHeightTable.java @@ -36,4 +36,4 @@ public class FixedHeightTable extends TestBase { protected Integer getTicketNumber() { return 3814; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItem.java b/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItem.java new file mode 100644 index 0000000000..4c0bea77ac --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItem.java @@ -0,0 +1,84 @@ +/* + * Copyright 2000-2013 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.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Table; + +/** + * Test to see if the correct row gets the focus when the row is selected from + * the serverside and forces the table to scroll down + * + * @author Vaadin Ltd + */ +public class FocusOnSelectedItem extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + + final Table table = new Table(); + table.setSelectable(true); + table.setImmediate(true); + + table.addContainerProperty("Property", String.class, null); + + for (int i = 0; i < 200; i++) { + table.addItem(new String[] { "Item " + i }, "Item " + i); + } + addComponent(table); + + Button button = new Button("Select"); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + table.setValue("Item 198"); + table.setCurrentPageFirstItemId("Item 198"); + table.focus(); + } + }); + addComponent(button); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Test whether the selected row retains focus."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 10522; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java b/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java new file mode 100644 index 0000000000..14a0718325 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/FocusOnSelectedItemTest.java @@ -0,0 +1,66 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test to see if the correct row gets the focus when the row is selected from + * the serverside and forces the table to scroll down + * + * @author Vaadin Ltd + */ +public class FocusOnSelectedItemTest extends MultiBrowserTest { + + @Test + public void selectAndScrollFocusesSelectedRow() { + openTestURL(); + + WebElement selectButton = $(ButtonElement.class).caption("Select") + .first(); + selectButton.click(); + WebElement supposedlyFocusedRow = null; + WebElement selectedRow = null; + WebElement focusedStyleRow = null; + + Assert.assertTrue("No row was selected", + isElementPresent(By.className("v-selected"))); + + selectedRow = getDriver().findElement(By.className("v-selected")); + + supposedlyFocusedRow = $(TableElement.class).first().getCell(198, 0); + + Assert.assertTrue("Incorrect row was selected", selectedRow + .getLocation().getY() == supposedlyFocusedRow.getLocation() + .getY()); + + Assert.assertTrue("No row had the focused style.", + isElementPresent(By.className("v-table-focus"))); + + focusedStyleRow = getDriver() + .findElement(By.className("v-table-focus")); + Assert.assertTrue("Incorrect row has the focused style.", selectedRow + .getLocation().getY() == focusedStyleRow.getLocation().getY()); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java index 32046932cc..fa88325429 100644 --- a/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java +++ b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/LastColumnNegative.java b/uitest/src/com/vaadin/tests/components/table/LastColumnNegative.java index b7379b4f2c..87ff6d9d7b 100644 --- a/uitest/src/com/vaadin/tests/components/table/LastColumnNegative.java +++ b/uitest/src/com/vaadin/tests/components/table/LastColumnNegative.java @@ -77,4 +77,4 @@ public class LastColumnNegative extends TestBase { return 8411; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java new file mode 100644 index 0000000000..e783951d86 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java @@ -0,0 +1,90 @@ +/* + * 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.components.table; + +import com.vaadin.annotations.Theme; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.Align; + +/** + * Test UI for issue #13399 : Left alignment should not be set explicitly + * instead of relying on default behavior + * + * @author Vaadin Ltd + */ +@Theme("tests-table") +public class LeftColumnAlignment extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Table table = new Table(); + + BeanItemContainer<Bean> container = new BeanItemContainer<Bean>( + Bean.class); + Bean bean = new Bean(); + bean.setName("property"); + container.addBean(bean); + table.setContainerDataSource(container); + + table.setFooterVisible(true); + + table.setWidth(100, Unit.PIXELS); + + table.setColumnAlignment("name", Align.RIGHT); + + addComponent(table); + + Button button = new Button("Align to Left"); + button.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + table.setColumnAlignment("name", Align.LEFT); + } + }); + addComponent(button); + } + + @Override + protected String getTestDescription() { + return "Left alignment should not be set explicitly instead of relying on default behavior"; + } + + @Override + protected Integer getTicketNumber() { + return 13399; + } + + public static class Bean { + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java new file mode 100644 index 0000000000..3d613fd726 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java @@ -0,0 +1,58 @@ +/* + * 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test class for issue #13399 : Left alignment should not be set explicitly + * instead of relying on default behavior + * + * @author Vaadin Ltd + */ +public class LeftColumnAlignmentTest extends MultiBrowserTest { + + @Test + public void testLeftColumnAlignment() throws Exception { + openTestURL(); + + // Do align columns to the left + WebElement webElement = driver.findElement(By.className("v-button")); + webElement.click(); + + Assert.assertTrue("Table caption is not aligned to the left", + isElementPresent(By + .className("v-table-caption-container-align-left"))); + + WebElement footer = driver.findElement(By + .className("v-table-footer-container")); + + Assert.assertEquals("Table footer is not aligned to the left", "left", + footer.getCssValue("text-align")); + + WebElement cell = driver.findElement(By + .className("v-table-cell-wrapper")); + + Assert.assertEquals("Table cell is not aligned to the left", "left", + cell.getCssValue("text-align")); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java b/uitest/src/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java index 12ae4a3c4d..9c063fd42e 100644 --- a/uitest/src/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java +++ b/uitest/src/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java @@ -90,4 +90,4 @@ public class MultiSelectWithRemovedRow extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(8584); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/OddEvenRowStyling.java b/uitest/src/com/vaadin/tests/components/table/OddEvenRowStyling.java index 837af06d9e..808b05e233 100644 --- a/uitest/src/com/vaadin/tests/components/table/OddEvenRowStyling.java +++ b/uitest/src/com/vaadin/tests/components/table/OddEvenRowStyling.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java index 3e233c69c2..809cb67226 100644 --- a/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java +++ b/uitest/src/com/vaadin/tests/components/table/RefreshRenderedCellsOnlyIfAttached.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/RemoveItemOnClick.java b/uitest/src/com/vaadin/tests/components/table/RemoveItemOnClick.java index 8f56965ddb..cb9dc57d09 100644 --- a/uitest/src/com/vaadin/tests/components/table/RemoveItemOnClick.java +++ b/uitest/src/com/vaadin/tests/components/table/RemoveItemOnClick.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java b/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java index 6007ea2984..6cc6a68a7d 100644 --- a/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java +++ b/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java b/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java index cf6a92c283..0fc09adf40 100644 --- a/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java +++ b/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -47,10 +47,11 @@ public class SelectAllRowsTest extends MultiBrowserTest { @Override public List<DesiredCapabilities> getBrowsersToTest() { - // Pressing Shift modifier key does not work with Firefox + // Pressing Shift modifier key does not work with Firefox and PhantomJS ArrayList<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( super.getBrowsersToTest()); browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); + browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); return browsers; } diff --git a/uitest/src/com/vaadin/tests/components/table/SelectionRangeDragging.html b/uitest/src/com/vaadin/tests/components/table/SelectionRangeDragging.html deleted file mode 100644 index 1e911699d1..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/SelectionRangeDragging.html +++ /dev/null @@ -1,52 +0,0 @@ -<?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.CtrlShiftMultiselect?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[1]/domChild[0]</td> - <td>112,12</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[10]/domChild[1]/domChild[0]</td> - <td>82,16:shift</td> -</tr> -<tr> - <td>drag</td> - <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[8]/domChild[1]/domChild[0]</td> - <td>87,1</td> -</tr> -<tr> - <td>mouseMoveAt</td> - <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td> - <td>700,210</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>multiple-rows-dragged</td> -</tr> -<tr> - <td>drop</td> - <td>vaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td> - <td>700,210</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemId.java b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemId.java index aebb494247..22e60406a6 100644 --- a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemId.java +++ b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemId.java @@ -53,4 +53,4 @@ public class SetCurrentPageFirstItemId extends TestBase { protected Integer getTicketNumber() { return 7607; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java index 574f1d1862..5e1c4cca66 100644 --- a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java +++ b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java index ecd2e3e9df..0dc8584169 100644 --- a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java +++ b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java b/uitest/src/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java index 039b02e801..eb5beec6bd 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java +++ b/uitest/src/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java @@ -154,4 +154,4 @@ public class TableAndBrowserContextMenu extends TestBase implements public void handleAction(Action action, Object sender, Object target) { getMainWindow().showNotification("Action: " + action.getCaption()); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java b/uitest/src/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java index a37cf48579..6fa86543cb 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java +++ b/uitest/src/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java @@ -85,4 +85,4 @@ public class TableClickValueChangeInteraction extends TestBase { result.addComponent(valueChangeLabel); return result; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableExtraScrollbars.java b/uitest/src/com/vaadin/tests/components/table/TableExtraScrollbars.java index fa10ab344c..ccf521c500 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableExtraScrollbars.java +++ b/uitest/src/com/vaadin/tests/components/table/TableExtraScrollbars.java @@ -58,4 +58,4 @@ public class TableExtraScrollbars extends AbstractTestCase { protected Integer getTicketNumber() { return 4489; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java index 95d5ea59d5..3f3255f525 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java +++ b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java @@ -85,4 +85,4 @@ public class TableFirstRowFlicker extends LegacyApplication { return cont; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java index 20170efa13..8f6e6c685f 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java +++ b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java index 5075e22f1b..30bddc2666 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TablePageLengthCalculation.java b/uitest/src/com/vaadin/tests/components/table/TablePageLengthCalculation.java index 55089ff56b..e56f686218 100644 --- a/uitest/src/com/vaadin/tests/components/table/TablePageLengthCalculation.java +++ b/uitest/src/com/vaadin/tests/components/table/TablePageLengthCalculation.java @@ -47,4 +47,4 @@ public class TablePageLengthCalculation extends TestBase { protected Integer getTicketNumber() { return 4374; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java index ab0198f39c..c21a38a0ac 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java +++ b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java index 68c8dc9884..968b742aa9 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollOnFocus.java b/uitest/src/com/vaadin/tests/components/table/TableScrollOnFocus.java index bfbc4f82c1..7e75e8a32d 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableScrollOnFocus.java +++ b/uitest/src/com/vaadin/tests/components/table/TableScrollOnFocus.java @@ -47,4 +47,4 @@ public class TableScrollOnFocus extends TestBase { protected Integer getTicketNumber() { return 6774; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelect.java b/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelect.java new file mode 100644 index 0000000000..0e2e1b76e1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelect.java @@ -0,0 +1,89 @@ +/* + * 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.components.table; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +/** + * Test to see if Table appears to scroll up under an obscure set of conditions + * (Scrolled down, set to expand, selecting updates a TextField that precedes + * the Table in a VerticalLayout.) (#10106) + * + * @author Vaadin Ltd + */ +public class TableScrollUpOnSelect extends AbstractTestUI { + public TextField text = null; + + @Override + protected void setup(VaadinRequest request) { + text = new TextField(); + text.setImmediate(true); + + final Table table = new Table(null); + table.addContainerProperty("value", Integer.class, 0); + for (int i = 0; i < 50; ++i) { + table.addItem(new Object[] { i }, i); + } + table.setSizeFull(); + table.setSelectable(true); + table.setImmediate(true); + table.setEditable(false); + + final VerticalLayout layout = new VerticalLayout(); + + table.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + if (table.getValue() != null) { + text.setValue(table.getValue().toString()); + } + } + + }); + + table.setCurrentPageFirstItemIndex(49); + + layout.setSizeFull(); + layout.addComponent(text); + layout.addComponent(table); + layout.setExpandRatio(table, 1.0f); + Window window = new Window(); + window.setHeight("600px"); + window.setWidth("400px"); + window.setModal(true); + window.setContent(layout); + getUI().addWindow(window); + } + + @Override + protected String getTestDescription() { + return "Table scrolls up when selecting a row"; + } + + @Override + protected Integer getTicketNumber() { + return 13358; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java b/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java new file mode 100644 index 0000000000..b2fde31b93 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableScrollUpOnSelectTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test to see if Table appears to scroll up under an obscure set of conditions + * (Scrolled down, set to expand, selecting updates a TextField that precedes + * the Table in a VerticalLayout.) (#10106) + * + * @author Vaadin Ltd + */ +public class TableScrollUpOnSelectTest extends MultiBrowserTest { + + @Test + public void TestThatSelectingDoesntScroll() { + openTestURL(); + + // WebElement table = driver.findElement(By.vaadin("//Table")); + WebElement row = $(TableElement.class).first().getCell(49, 0); + final WebElement scrollPositionDisplay = getDriver().findElement( + By.className("v-table-scrollposition")); + waitUntilNot(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + return scrollPositionDisplay.isDisplayed(); + } + }, 10); + + int rowLocation = row.getLocation().getY(); + row.click(); + int newRowLocation = row.getLocation().getY(); + + Assert.assertTrue("Table has scrolled.", rowLocation == newRowLocation); + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainer.java b/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainer.java index 764207ff13..61f8952041 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainer.java @@ -96,4 +96,4 @@ public class TableScrollingWithSQLContainer extends UI { e.printStackTrace(); } } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainerTest.java b/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainerTest.java index 97c780e0e8..01f75f7875 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainerTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableScrollingWithSQLContainerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java index f84f83718d..da37d1f2d2 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java +++ b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -66,4 +66,4 @@ public class TableSizeInTabsheet extends AbstractTestUI { return 12687; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java index 29fc5a2e52..a984ed81e5 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableSorting.java b/uitest/src/com/vaadin/tests/components/table/TableSorting.java index 6417e8e853..85819784c0 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableSorting.java +++ b/uitest/src/com/vaadin/tests/components/table/TableSorting.java @@ -65,4 +65,4 @@ public class TableSorting extends TestBase { protected Integer getTicketNumber() { return 4537; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableSortingIndicator.java b/uitest/src/com/vaadin/tests/components/table/TableSortingIndicator.java new file mode 100644 index 0000000000..93fe8d7d9e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSortingIndicator.java @@ -0,0 +1,129 @@ +/* + * Copyright 2000-2013 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.components.table; + +import java.util.Random; + +import com.vaadin.data.Container; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Table; + +/** + * Test if the table sorting indicators update correctly when the table is + * sorted serverside + * + * @author Vaadin Ltd + */ +public class TableSortingIndicator extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final Table table = new Table("Test table", buildContainer()); + table.setSizeFull(); + addComponent(table); + Button sortButton = new Button("Sort", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + table.sort(new Object[] { "val1" }, new boolean[] { false }); + } + }); + addComponent(sortButton); + } + + private Container buildContainer() { + BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + TestBean.class); + for (int i = 0; i < 100; ++i) { + TestBean item = new TestBean(); + item.setVal1(i); + item.setVal2(randomWord()); + item.setVal3(randomWord()); + container.addBean(item); + } + return container; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "The table should have visible sorting indicators."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 8978; + } + + public class TestBean { + private Integer val1; + private String val2; + private String val3; + + public Integer getVal1() { + return val1; + } + + public void setVal1(Integer val1) { + this.val1 = val1; + } + + public String getVal2() { + return val2; + } + + public void setVal2(String val2) { + this.val2 = val2; + } + + public String getVal3() { + return val3; + } + + public void setVal3(String val3) { + this.val3 = val3; + } + } + + private String randomWord() { + Random rng = new Random(); + char[] word = new char[3 + rng.nextInt(10)]; + for (int i = 0; i < word.length; ++i) { + word[i] = (char) ('a' + rng.nextInt(26)); + } + return new String(word); + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableSortingIndicatorTest.java b/uitest/src/com/vaadin/tests/components/table/TableSortingIndicatorTest.java new file mode 100644 index 0000000000..36a51b35e3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSortingIndicatorTest.java @@ -0,0 +1,65 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests if the sort indicator is visible after the table has been sorted from + * the serverside. + * + * @author Vaadin Ltd + */ +public class TableSortingIndicatorTest extends MultiBrowserTest { + private static final String TABLE_HEADER_DESC_INDICATOR = "v-table-header-cell-desc"; + private static final String TABLE_HEADER_ASC_INDICATOR = "v-table-header-cell-asc"; + + @Test + public void testTableSortingIndicatorIsVisibleAfterServersideSort() { + openTestURL(); + + Assert.assertFalse("Descending indicator was prematurely visible", + isElementPresent(By.className(TABLE_HEADER_DESC_INDICATOR))); + Assert.assertFalse("Ascending indicator was prematurely visible", + isElementPresent(By.className(TABLE_HEADER_ASC_INDICATOR))); + WebElement button = driver.findElement(By + .vaadin("//Button[caption=\"Sort\"]")); + button.click(); + Assert.assertTrue("Indicator did not become visible", + isElementPresent(By.className(TABLE_HEADER_DESC_INDICATOR))); + + Assert.assertFalse("Ascending sort indicator was wrongly visible", + isElementPresent(By.className(TABLE_HEADER_ASC_INDICATOR))); + WebElement manualSort = driver.findElement(By + .className(TABLE_HEADER_DESC_INDICATOR)); + manualSort.click(); + Assert.assertFalse("Table sort indicator didn't change", + isElementPresent(By.className(TABLE_HEADER_DESC_INDICATOR))); + Assert.assertTrue("Ascending sort indicator didn't become visible", + isElementPresent(By.className(TABLE_HEADER_ASC_INDICATOR))); + button.click(); + Assert.assertTrue( + "Descending sort indicator didn't appear on the second serverside sort.", + isElementPresent(By.className(TABLE_HEADER_DESC_INDICATOR))); + Assert.assertFalse("Ascending sort indicator didn't disappear", + isElementPresent(By.className(TABLE_HEADER_ASC_INDICATOR))); + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java index 5191b1b86e..0b40af94a2 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java @@ -139,4 +139,4 @@ public class TableSqlContainer extends AbstractTestUI { return 11224; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableToggleVisibility.java b/uitest/src/com/vaadin/tests/components/table/TableToggleVisibility.java index 22cdf7f312..f89d2d2934 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableToggleVisibility.java +++ b/uitest/src/com/vaadin/tests/components/table/TableToggleVisibility.java @@ -168,4 +168,4 @@ public class TableToggleVisibility extends AbstractTestCase { return 6494; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemove.java b/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemove.java new file mode 100644 index 0000000000..79a85cd49b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemove.java @@ -0,0 +1,92 @@ +/* + * Copyright 2000-2013 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.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Table; + +/** + * Test whether adding the first item to a table calculates the table width + * correctly + * + * @author Vaadin Ltd + */ +public class TableWidthItemRemove extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final Table table = new Table("My table"); + table.addContainerProperty("firstName", String.class, null); + table.addContainerProperty("lastName", String.class, null); + table.addContainerProperty("year", Integer.class, null); + table.setColumnWidth("firstName", 200); + table.setColumnWidth("lastName", 100); + table.setColumnWidth("year", 50); + + Button cleanButton = new Button("Clean"); + cleanButton.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + table.removeAllItems(); + } + }); + addComponent(cleanButton); + + Button populateButton = new Button("Populate"); + populateButton.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + table.addItem( + new Object[] { "John", "Doe", new Integer(1980) }, + Math.random() * 1000); + } + }); + addComponent(populateButton); + + addComponent(table); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "The table should retain the correct width on item remove and add."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 13592; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java b/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java new file mode 100644 index 0000000000..f96641be4c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableWidthItemRemoveTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2013 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.components.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test whether adding the first item to a table calculates the table width + * correctly + * + * @author Vaadin Ltd + */ +public class TableWidthItemRemoveTest extends MultiBrowserTest { + @Test + public void testWidthResizeOnItemAdd() { + openTestURL(); + + WebElement populateButton = driver.findElement(By + .vaadin("//Button[caption=\"Populate\"]")); + WebElement table = driver.findElement(By + .vaadin("//Table[caption=\"My table\"]")); + int original_width = table.getSize().getWidth(); + populateButton.click(); + Assert.assertTrue("Width changed on item add.", original_width == table + .getSize().getWidth()); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java index efa1b1bdab..c571329d14 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithPolling.java b/uitest/src/com/vaadin/tests/components/table/TableWithPolling.java new file mode 100644 index 0000000000..fdd5c2901a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableWithPolling.java @@ -0,0 +1,60 @@ +/* + * 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.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; + +public class TableWithPolling extends AbstractTestUI { + + @Override + protected String getTestDescription() { + return "Polling shouldn't affect table column resizing in any way."; + } + + @Override + protected Integer getTicketNumber() { + return 13432; + } + + @Override + protected void setup(VaadinRequest request) { + + Table table = new Table("This is my Table"); + + table.addContainerProperty("First Name", String.class, null); + table.addContainerProperty("Last Name", String.class, null); + table.addContainerProperty("Year", Integer.class, null); + + table.addItem(new Object[] { "Nicolaus", "Copernicus", + new Integer(1473) }, new Integer(1)); + table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) }, + new Integer(2)); + table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) }, + new Integer(3)); + table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) }, + new Integer(4)); + table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) }, + new Integer(5)); + table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) }, + new Integer(6)); + + addComponent(table); + + setPollInterval(1000); + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java b/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java new file mode 100644 index 0000000000..6aae1e27fc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java @@ -0,0 +1,65 @@ +/* + * 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.components.table; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TableWithPollingTest extends MultiBrowserTest { + + @Test + public void testColumnResizing() throws Exception { + openTestURL(); + + WebElement headerCell = driver.findElement(By + .xpath("(//td[contains(@class, 'v-table-header-cell')])[1]")); + WebElement bodyCell = driver.findElement(By + .xpath("(//td[contains(@class, 'v-table-cell-content')])[1]")); + WebElement resizer = driver.findElement(By + .xpath("(//div[contains(@class, 'v-table-resizer')])[1]")); + + final int offset = 50; + final int headerCellWidth = headerCell.getSize().width; + final int bodyCellWidth = bodyCell.getSize().width; + + new Actions(driver).clickAndHold(resizer).moveByOffset(offset, 0) + .perform(); + sleep(2000); + new Actions(driver).release().perform(); + + Assert.assertEquals(headerCellWidth + offset, + headerCell.getSize().width); + Assert.assertEquals(bodyCellWidth + offset, bodyCell.getSize().width); + } + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + // Selenium has issues with drag-and-drop on IE8 making it impossible to + // drag a target as small as the table resizer. So we'll just have to + // ignore IE8 completely. + List<DesiredCapabilities> browsers = super.getBrowsersToTest(); + browsers.remove(Browser.IE8.getDesiredCapabilities()); + return browsers; + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/WideSelectableTable.java b/uitest/src/com/vaadin/tests/components/table/WideSelectableTable.java index c820dc08d5..60e7db5c0d 100644 --- a/uitest/src/com/vaadin/tests/components/table/WideSelectableTable.java +++ b/uitest/src/com/vaadin/tests/components/table/WideSelectableTable.java @@ -42,4 +42,4 @@ public class WideSelectableTable extends TestBase { protected Integer getTicketNumber() { return 6788; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java index dabc9c8e0b..cebb00c11b 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/EmptyTabSheetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -27,4 +27,4 @@ public class EmptyTabSheetTest extends MultiBrowserTest { compareScreen("empty"); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java index 31a59aaed6..dd0d8fb44f 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/PreventTabChangeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -59,4 +59,4 @@ public class PreventTabChangeTest extends MultiBrowserTest { .vaadin("//TabSheet#tabpanel")); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java b/uitest/src/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java index de250539ff..12da99b7f4 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/ScrollbarsInNestedTabsheets.java @@ -55,4 +55,4 @@ public class ScrollbarsInNestedTabsheets extends TestBase { return 8625; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java index 01bce334db..accd77ae0e 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidth.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java index f09a68d576..a30a155c01 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabBarWidthTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java index 02482b7049..d9cc077f67 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java index f6ce33121c..d639cd2ddc 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java index 81648c1b52..12ae03080b 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -18,10 +18,13 @@ package com.vaadin.tests.components.tabsheet; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.List; + import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.testbench.By; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -29,6 +32,15 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class TabSheetFocusedTabTest extends MultiBrowserTest { @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsers = super.getBrowsersToTest(); + // PhantomJS doesn't send Focus / Blur events when clicking or + // navigating with keyboard + browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); + return browsers; + } + + @Override protected Class<?> getUIClass() { return TabsheetScrolling.class; } @@ -41,7 +53,7 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest { assertTrue(isFocused(getTab(1))); - new Actions(getDriver()).sendKeys(Keys.RIGHT).perform(); + new Actions(getDriver()).sendKeys(Keys.ARROW_RIGHT).perform(); assertFalse(isFocused(getTab(1))); assertTrue(isFocused(getTab(3))); @@ -65,6 +77,7 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest { } private boolean isFocused(WebElement tab) { + return tab.getAttribute("class").contains("v-tabsheet-tabitem-focus"); } diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusing.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusing.java index b6b5431c1f..941073d617 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusing.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusing.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusingTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusingTest.java index 77ddc94567..62948bed06 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusingTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java index c0b30ff68d..779ab6b614 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java index ccdc4ecb38..c5e01969a1 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java @@ -46,7 +46,7 @@ public class TabSheetIcons extends TestBase { for (Component c : tab) { tabsheet.addTab(c); - tabsheet.getTab(c).setIconAltText( + tabsheet.getTab(c).setIconAlternateText( "iconalt" + tabsheet.getComponentCount()); } diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabStyleNames.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabStyleNames.java index 54a5ed4857..c14203e765 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabStyleNames.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabStyleNames.java @@ -49,4 +49,4 @@ public class TabSheetTabStyleNames extends TestBase { protected Integer getTicketNumber() { return 5880; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java index a2c75d6e79..5c76effefd 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabTheming.java @@ -25,4 +25,4 @@ public class TabSheetTabTheming extends TestBase { protected Integer getTicketNumber() { return 6781; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithTabIds.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithTabIds.java index ae5adea45e..42d65f66c9 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithTabIds.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithTabIds.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java index b55f1057b5..1da42bb1ce 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -22,6 +22,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class TabsheetScrollingTest extends MultiBrowserTest { @@ -38,19 +39,11 @@ public class TabsheetScrollingTest extends MultiBrowserTest { } private WebElement getTab(int index) { - return getDriver().findElement( - By.vaadin("/VVerticalLayout[0]/Slot[1]" - + "/VVerticalLayout[0]/Slot[0]/VTabsheet[0]" - + "/domChild[0]/domChild[0]/domChild[0]" - + "/domChild[0]/domChild[" + index + "]")); - + return getDriver().findElement(By.vaadin("//TabSheet#tab[1]")); } private String getHideButtonText() { - WebElement buttonCaption = getDriver().findElement( - By.vaadin("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]" - + "/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]" - + "/VButton[0]/domChild[0]/domChild[0]")); + ButtonElement buttonCaption = $(ButtonElement.class).first(); return buttonCaption.getText(); } diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetShouldUpdateHeight.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetShouldUpdateHeight.java index 5271f467dc..bbbd4ca7e4 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetShouldUpdateHeight.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetShouldUpdateHeight.java @@ -57,4 +57,4 @@ public class TabsheetShouldUpdateHeight extends TestBase { protected Integer getTicketNumber() { return 9275; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java index 26716846fc..ac51b5fc87 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java +++ b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java index 4b522a1f37..4d750d183f 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java +++ b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/textfield/BigDecimalTextField.java b/uitest/src/com/vaadin/tests/components/textfield/BigDecimalTextField.java index 18d8679c2f..c7e449c314 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/BigDecimalTextField.java +++ b/uitest/src/com/vaadin/tests/components/textfield/BigDecimalTextField.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java b/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java index 58bc4c5383..24feab5cab 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java +++ b/uitest/src/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java @@ -57,4 +57,4 @@ public class MultipleTextChangeEvents extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(8035); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents.java index b38dd36284..531392b84a 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents.java @@ -126,4 +126,4 @@ public class TextChangeEvents extends TestBase { } } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents2.java b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents2.java index 538589808d..d64dbb42d6 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents2.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEvents2.java @@ -184,4 +184,4 @@ public class TextChangeEvents2 extends TestBase { return 2387; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java index 1a49729b6f..331c8d2efc 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java @@ -30,4 +30,4 @@ public class TextChangeEventsEternalLoop extends TestBase { return 6376; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java index 2a9df42ba1..c125d8da86 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java index 06b8af1ec6..f3e47d0996 100644 --- a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java +++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java @@ -132,4 +132,4 @@ public class SimpleTree extends TestBase implements Action.Handler { public void handleAction(Action action, Object sender, Object target) { System.out.println("Action: " + action.getCaption()); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java index 13edf9e37f..6df69c850b 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeFiltering.java @@ -131,4 +131,4 @@ public class TreeFiltering extends TestBase { return 4192; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java index 7182e3b4d1..bb7c0350f2 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeKeyboardNavigationScrolls.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java index 76ab1b3fdb..b8715ed505 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java index 99618c0e5d..a1576ffed1 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeWithIcons.java @@ -66,4 +66,4 @@ public class TreeWithIcons extends TestBase { return 3529; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/AddNodesOnExpand.java b/uitest/src/com/vaadin/tests/components/treetable/AddNodesOnExpand.java index f6b32aa4a9..d048f0a4f4 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/AddNodesOnExpand.java +++ b/uitest/src/com/vaadin/tests/components/treetable/AddNodesOnExpand.java @@ -55,4 +55,4 @@ public class AddNodesOnExpand extends TestBase { protected Integer getTicketNumber() { return Integer.valueOf(8041); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java b/uitest/src/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java index 4cf17aef48..3d40bc47cf 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java +++ b/uitest/src/com/vaadin/tests/components/treetable/ChangeDataSourcePageLengthZero.java @@ -90,4 +90,4 @@ public class ChangeDataSourcePageLengthZero extends TestBase { protected Integer getTicketNumber() { return 7908; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/DynamicallyModified.java b/uitest/src/com/vaadin/tests/components/treetable/DynamicallyModified.java index 6dc5417d28..e089237b54 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/DynamicallyModified.java +++ b/uitest/src/com/vaadin/tests/components/treetable/DynamicallyModified.java @@ -124,4 +124,4 @@ public class DynamicallyModified extends TestBase implements } } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/RemoveAllItemsRefresh.java b/uitest/src/com/vaadin/tests/components/treetable/RemoveAllItemsRefresh.java index d34522073d..4372341161 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/RemoveAllItemsRefresh.java +++ b/uitest/src/com/vaadin/tests/components/treetable/RemoveAllItemsRefresh.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java index 85a69702a4..de33d26051 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java @@ -257,4 +257,4 @@ public class TreeTableCacheOnPartialUpdates extends TestBase { // TODO Auto-generated method stub return null; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java index 3ed5da1833..7f4aa7f671 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScroll.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScroll.java new file mode 100644 index 0000000000..82c04191d1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScroll.java @@ -0,0 +1,56 @@ +/* + * Copyright 2000-2013 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.components.ui; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComboBox; + +/** + * Test UI for issue #13488, where scrolling to the next page with pagelength 0 + * would break the rendering of any page except the first. + * + * @author Vaadin Ltd + */ +@SuppressWarnings("serial") +public class ComboboxPageLengthZeroScroll extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + ComboBox combobox = new ComboBox("New items enabled:"); + combobox.setPageLength(0); + + for (int i = 0; i++ < 10;) { + combobox.addItem("1 AMERICAN SAMOA " + i); + combobox.addItem("ANTIGUA AND BARBUDA " + i); + } + + getLayout().addComponent(combobox); + getLayout().addComponent(new Button("dummy")); + } + + @Override + protected String getTestDescription() { + return "Scrolling with pagelength == 0 previously resulted in broken style, should be fixed now"; + } + + @Override + protected Integer getTicketNumber() { + return 13488; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScrollTest.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScrollTest.java new file mode 100644 index 0000000000..eecf83417e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxPageLengthZeroScrollTest.java @@ -0,0 +1,63 @@ +/* + * 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.components.ui; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test class for testing issue #13488 - changing pages with pagelength=0 breaks + * the style. + * + * @author Vaadin Ltd + */ + +public class ComboboxPageLengthZeroScrollTest extends MultiBrowserTest { + @Test + public void testComboboxPageLength() { + openTestURL(); + + WebElement comboBox = vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textbox"); + + // navigate to the next page. keyboard navigation is the preferred + // method here since it's much easier to implement. + + Actions keyNavigation = new Actions(driver).moveToElement(comboBox) + .click(); + + for (int i = 0; i < 25; ++i) { + keyNavigation.sendKeys(Keys.ARROW_DOWN); + + } + keyNavigation.perform(); + + // The broken behavior always caused a v-shadow element to have + // height: 10px. Verify that this does no longer happen. + + String cssValue = driver.findElement(By.className("v-shadow")) + .getCssValue("height"); + + Assert.assertNotEquals("v-shadow height should not be 10px", "10px", + cssValue); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidth.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidth.java new file mode 100644 index 0000000000..6e5ca36f31 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidth.java @@ -0,0 +1,65 @@ +/* + * 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.components.ui; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.ComboBox; + +/** + * Test UI for adding a stylename to a combobox with an undefined width. + * + * @author Vaadin Ltd + */ +public class ComboboxStyleChangeWidth extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + final ComboBox cbFoo = new ComboBox(); + cbFoo.setImmediate(true); + cbFoo.setSizeUndefined(); + cbFoo.addItem("A really long string that causes an inline width to be set"); + + Button btn = new Button("Click to break CB", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + cbFoo.addStyleName("foofoo"); + + } + }); + + addComponent(cbFoo); + addComponent(btn); + + } + + @Override + protected String getTestDescription() { + return "The computed inline width of an undefined-width ComboBox " + + "(with a sufficiently long option string) breaks when " + + "the component's stylename is changed after initial " + + "rendering."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(13444); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidthTest.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidthTest.java new file mode 100644 index 0000000000..c0845cabb0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxStyleChangeWidthTest.java @@ -0,0 +1,52 @@ +/* + * 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.components.ui; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that changing a stylename will not cause the width parameter to be + * removed from a combobox. + * + * @author Vaadin Ltd + */ + +public class ComboboxStyleChangeWidthTest extends MultiBrowserTest { + + @Test + public void testWidthRetained() { + openTestURL(); + + WebElement comboBox = driver + .findElement(By.className("v-filterselect")); + String oldStyle = comboBox.getAttribute("style"); + + WebElement button = driver.findElement(By.className("v-button")); + button.click(); + String newStyle = comboBox.getAttribute("style"); + + assertEquals("width has changed, should remain equal", oldStyle, + newStyle); + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java index f27ef5d789..4bab0e5237 100644 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java index ec8add75e0..429bcc0afc 100644 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java index b0127e3a75..cba2adb5db 100644 --- a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java +++ b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java index 3542806a92..a960e9cc46 100644 --- a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java +++ b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java b/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java index 8f3e08335f..007a49e0e2 100644 --- a/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java b/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java index 0e5ddaab87..c5861147a5 100644 --- a/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java index 96c02a2460..40ec51cf1f 100644 --- a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java +++ b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java new file mode 100644 index 0000000000..4235f5a989 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java @@ -0,0 +1,98 @@ +/* + * 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.components.ui; + +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; + +/** + * UI test for TextArea behavior when ENTER has been assigned as a keyboard + * shortcut. + * + * @author Vaadin Ltd + */ +public class TextAreaEventPropagation extends AbstractTestUIWithLog { + + protected static final String BUTTON_PRESSED = "Button Pressed"; + + protected static final String NO_BUTTON_PRESSED = "No Button Pressed"; + + private Label enterButtonPressed; + + private Label escapeButtonPressed; + + @Override + protected void setup(VaadinRequest request) { + + FormLayout form = new FormLayout(); + TextArea textArea = new TextArea("Text input"); + TextField textField = new TextField("Text field input"); + enterButtonPressed = new Label(NO_BUTTON_PRESSED); + enterButtonPressed.setCaption("Enter Label"); + escapeButtonPressed = new Label(NO_BUTTON_PRESSED); + escapeButtonPressed.setCaption("Escape Label"); + + Button enterButton = new Button("Enter"); + enterButton.setClickShortcut(KeyCode.ENTER); + enterButton.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + enterButtonPressed.setValue(BUTTON_PRESSED); + } + }); + + Button escapeButton = new Button("Escape"); + escapeButton.setClickShortcut(KeyCode.ESCAPE); + escapeButton.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + escapeButtonPressed.setValue(BUTTON_PRESSED); + } + }); + + form.addComponent(textArea); + form.addComponent(textField); + form.addComponent(enterButton); + form.addComponent(escapeButton); + form.addComponent(enterButtonPressed); + form.addComponent(escapeButtonPressed); + addComponent(form); + + } + + @Override + protected String getTestDescription() { + return "Currently if enter key is set as a shortcut for some component, it won't be possible for the user to enter newline in a textarea."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(12424); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java new file mode 100644 index 0000000000..b1c38df460 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java @@ -0,0 +1,120 @@ +/* + * 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.components.ui; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.TextAreaElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that the TextArea widget correctly stops ENTER events from propagating. + * + * @author Vaadin Ltd + */ +public class TextAreaEventPropagationTest extends MultiBrowserTest { + + @Test + public void testTextAreaEnterEventPropagation() throws InterruptedException { + openTestURL(); + WebElement textArea = $(TextAreaElement.class).first(); + Actions builder = new Actions(driver); + builder.click(textArea); + builder.sendKeys(textArea, "first line asdf"); + builder.sendKeys(Keys.ENTER); + builder.sendKeys(textArea, "second line jkl;"); + builder.perform(); + + String text = $(LabelElement.class).caption("Enter Label").first() + .getText(); + assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); + + WebElement textField = $(TextFieldElement.class).first(); + Actions builder2 = new Actions(driver); + builder2.click(textField); + + builder2.sendKeys("third line"); + builder2.sendKeys(Keys.ENTER); + + builder2.perform(); + + text = $(LabelElement.class).caption("Enter Label").first().getText(); + + assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); + + } + + @Test + public void testTextAreaEscapeEventPropagation() + throws InterruptedException { + openTestURL(); + WebElement textArea = $(TextAreaElement.class).first(); + Actions builder = new Actions(driver); + builder.click(textArea); + builder.sendKeys(textArea, "first line asdf"); + builder.sendKeys(Keys.ENTER); + builder.sendKeys(textArea, "second line jkl;"); + builder.sendKeys(Keys.ESCAPE); + builder.perform(); + + String text = $(LabelElement.class).caption("Enter Label").first() + .getText(); + assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); + text = $(LabelElement.class).caption("Escape Label").first().getText(); + assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); + + } + + @Test + public void testTextFieldEscapeEventPropagation() + throws InterruptedException { + openTestURL(); + WebElement textArea = $(TextAreaElement.class).first(); + Actions builder = new Actions(driver); + builder.click(textArea); + builder.sendKeys(textArea, "first line asdf"); + builder.sendKeys(Keys.ENTER); + builder.sendKeys(textArea, "second line jkl;"); + builder.perform(); + + String text = $(LabelElement.class).caption("Enter Label").first() + .getText(); + assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); + + WebElement textField = $(TextFieldElement.class).first(); + Actions builder2 = new Actions(driver); + builder2.click(textField); + + builder2.sendKeys("third line"); + builder2.sendKeys(Keys.ENTER); + builder2.sendKeys(Keys.ESCAPE); + + builder2.perform(); + + text = $(LabelElement.class).caption("Enter Label").first().getText(); + assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); + text = $(LabelElement.class).caption("Escape Label").first().getText(); + assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); + + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java index 2c649c9ca8..cb62ccdb19 100644 --- a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java +++ b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -23,22 +23,50 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; public class TimeoutRedirectResetsOnActivity extends AbstractTestUI { + private int maxActiveInterval = 15; + private int timeoutOverhead = 15; + @Override protected void setup(VaadinRequest request) { - setupTimout(request); + setupTimeout(request); + + Label startedLabel = new Label(); + startedLabel.setValue(String.valueOf(System.currentTimeMillis())); + startedLabel.setId("startedTime"); + + Label originalLabel = new Label(); + originalLabel.setId("originalExpireTime"); + originalLabel.setValue(String.valueOf(getExpireTime())); - addComponent(new Button("clicky", new Button.ClickListener() { + final Label expiresLabel = new Label(); + expiresLabel.setId("actualExpireTime"); + + Button button = new Button("Reset", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - // NOOP + expiresLabel.setValue(String.valueOf(getExpireTime())); } - })); + + }); + button.setId("reset"); + + addComponent(button); + + addComponent(startedLabel); + addComponent(originalLabel); + addComponent(expiresLabel); + } + + private long getExpireTime() { + return System.currentTimeMillis() + + (maxActiveInterval + timeoutOverhead) * 1000; } - private void setupTimout(VaadinRequest request) { + private void setupTimeout(VaadinRequest request) { request.getService().setSystemMessagesProvider( new SystemMessagesProvider() { @Override @@ -57,7 +85,7 @@ public class TimeoutRedirectResetsOnActivity extends AbstractTestUI { * implementation details in * com.vaadin.server.communication.MetadataWriter */ - getSession().getSession().setMaxInactiveInterval(10); + getSession().getSession().setMaxInactiveInterval(maxActiveInterval); } @Override diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java index 272bacb8d5..b5440b8f76 100644 --- a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -15,71 +15,64 @@ */ package com.vaadin.tests.components.ui; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; +import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.RetryOnFail; public class TimeoutRedirectResetsOnActivityTest extends MultiBrowserTest { + + @Rule + // Timing issues are really hard to resolve in a way that this test would be + // 100% reliable on all browsers. Hence we shall allow one retry. + public RetryOnFail retry = new RetryOnFail(); + + private int waitBeforeActivity = 4000; + private int communicationOverhead = 2000; + + private static int i = 0; + @Test + @Ignore("The test modifies the system messages, which are global and the changes will affect other tests") public void verifyRedirectWorks() throws Exception { setDebug(true); openTestURL(); - long startTime = System.currentTimeMillis(); - while (System.currentTimeMillis() - startTime < 30000) { - clickTheButton(); - Thread.sleep(1000); - } + long startedTime = getTime("startedTime"); + long originalExpireTime = getTime("originalExpireTime"); - assertTrue("button disappeared before timeout", buttonIsStillThere()); + Thread.sleep(waitBeforeActivity); + hitButton("reset"); - Thread.sleep(30000); - assertTrue("no redirection occurred within 30 seconds", - !buttonIsStillThere()); - } + Thread.sleep(200); - private boolean buttonIsStillThere() { - try { - return getButton() != null; - } catch (NoSuchElementException e) { - return false; - } - } + long actualExpireTime = getTime("actualExpireTime"); + + Thread.sleep(originalExpireTime - startedTime - waitBeforeActivity); + + assertThat(driver.getCurrentUrl(), is(getTestUrl())); + + testBench().disableWaitForVaadin(); + Thread.sleep(actualExpireTime - originalExpireTime + + communicationOverhead); - private void clickTheButton() { - getButton().click(); + assertThat(driver.getCurrentUrl(), is(not(getTestUrl()))); } - private WebElement getButton() { - /* - * For some reason, the vaadinElement() method doesn't work when tests - * are run outside of "/run/" and "/run-push/" contexts. The given error - * message says that the generated Vaadin path doesn't match any - * elements, but when that selector is put into the recorder, the - * recorder finds it. - * - * XPath works fine. - */ - /*- - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); - */ - return getDriver().findElement( - By.xpath("//div[contains(@class,'v-button')]")); + private long getTime(String id) { + WebElement element = vaadinElementById(id); + return Long.parseLong(element.getText()); } @Override - protected String getDeploymentPath() { - /* - * AbstractTB3Test assumes only /run/ and /run-push/ contexts, so this - * method needs some overriding. - */ - return "/12446/" - + TimeoutRedirectResetsOnActivity.class.getCanonicalName() - + "?restartApplication&debug"; + protected String getTestUrl() { + return super.getTestUrl() + "?restartApplication"; } } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java index d036827159..648e3aff8b 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java index 1cd4be576b..7fb5f9cd9d 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java index 9db2c2f0d3..39d6c12bfc 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -201,4 +201,4 @@ public class UIAccessTest extends MultiBrowserTest { private WebElement getCurrentInstanceWhenPushingButton() { return vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]"); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java index dc88865621..7d5bbe156b 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java index 48671191ca..7d9f09892c 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinit.java b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java index bef7a5a6d1..9fcc1eedde 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIReinit.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -22,7 +22,7 @@ import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Label; @PreserveOnRefresh -public class UIReinit extends AbstractTestUI { +public class UIRefresh extends AbstractTestUI { public static final String REINIT_ID = "reinit"; @@ -31,7 +31,7 @@ public class UIReinit extends AbstractTestUI { } @Override - protected void reinit(VaadinRequest request) { + protected void refresh(VaadinRequest request) { Label l = new Label("Reinit!"); l.setId(REINIT_ID); addComponent(l); diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java index 82132d3c65..7d701f4ae0 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 @@ -22,18 +22,18 @@ import org.junit.Test; import com.vaadin.testbench.By; import com.vaadin.tests.tb3.MultiBrowserTest; -public class UIReinitTest extends MultiBrowserTest { +public class UIRefreshTest extends MultiBrowserTest { @Test - public void testUIReinit() { + public void testUIRefresh() { openTestURL(); Assert.assertFalse(reinitLabelExists()); - // Reload the page; UI.reinit should be invoked + // Reload the page; UI.refresh should be invoked openTestURL(); Assert.assertTrue(reinitLabelExists()); } private boolean reinitLabelExists() { - return !getDriver().findElements(By.id(UIReinit.REINIT_ID)).isEmpty(); + return !getDriver().findElements(By.id(UIRefresh.REINIT_ID)).isEmpty(); } } diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java index 90021a0bf4..cbd317b027 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java +++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java index c304293170..ecde5760c9 100644 --- a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java +++ b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java index 1b30c4080a..30dbefc06b 100644 --- a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpened.java b/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpened.java index b568b4d46a..849d756ca9 100644 --- a/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpened.java +++ b/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpened.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpenedTest.java b/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpenedTest.java index 8104640987..f59c4bd762 100644 --- a/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpenedTest.java +++ b/uitest/src/com/vaadin/tests/components/window/BackspaceKeyWithModalOpenedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindow.java b/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindow.java new file mode 100644 index 0000000000..4e07c591ae --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindow.java @@ -0,0 +1,135 @@ +/* + * 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.components.window; + +import com.vaadin.data.Item; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.TreeTable; +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; + +@SuppressWarnings("serial") +public class CloseModalSubWindow extends AbstractTestUIWithLog { + + public static final String SUB_WINDOW = "sub-win"; + public static final String TREE_TABLE = "treetable"; + public static final String DELETE_BUTTON = "del-btn"; + public static final String CONFIRM_BUTTON = "confirm-btn"; + + private ConfirmWindow win; + + private TreeTable table; + + @Override + protected String getTestDescription() { + return "Lists a dozen items in a TreeTable with a Delete Button in each row. " + + "Delete button will open an sub-window allowing user to either confirm delete operation or cancel. " + + "Confirming should close the sub-window at the same time as the item is removed from the TreeTable."; + } + + @Override + protected Integer getTicketNumber() { + return 13188; + } + + @SuppressWarnings("unchecked") + @Override + protected void setup(VaadinRequest request) { + table = new TreeTable(); + table.setId(TREE_TABLE); + table.addContainerProperty("column", String.class, null); + table.addContainerProperty("delete", Button.class, null); + + for (int i = 0; i < 10; i++) { + Item item = table.addItem(i); + item.getItemProperty("column").setValue("" + i); + + Button b = new Button("Delete", deleteClickListener); + b.setId(DELETE_BUTTON + i); + b.setData(i); + item.getItemProperty("delete").setValue(b); + } + + table.setSortEnabled(false); + table.setColumnReorderingAllowed(false); + table.setEditable(true); + table.setPageLength(0); + + addComponent(table); + + } + + private void deleteItem(Object itemId) { + table.removeItem(itemId); + } + + private ClickListener deleteClickListener = new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + win = new ConfirmWindow(event.getButton().getData()); + log("Modal sub-window opened"); + } + }; + + private ClickListener confirmClickListener = new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + deleteItem(event.getButton().getData()); + win.close(); + log("Modal sub-window closed"); + } + }; + + private ClickListener cancelClickListener = new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + win.close(); + log("Modal sub-window closed"); + } + }; + + /** Modal confirmation sub-window. */ + class ConfirmWindow extends Window { + + public ConfirmWindow(Object itemId) { + setModal(true); + setWidth("300px"); + setHeight("200px"); + setId(SUB_WINDOW); + + Button ok = new Button("Confirm Delete", confirmClickListener); + ok.setId(CONFIRM_BUTTON); + ok.setData(itemId); + Button cancel = new Button("Cancel", cancelClickListener); + + HorizontalLayout l = new HorizontalLayout(); + l.addComponent(ok); + l.addComponent(cancel); + + setContent(l); + + UI.getCurrent().addWindow(this); + } + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindowTest.java b/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindowTest.java new file mode 100644 index 0000000000..aec0a7c9df --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/CloseModalSubWindowTest.java @@ -0,0 +1,75 @@ +/* + * 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.components.window; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class CloseModalSubWindowTest extends MultiBrowserTest { + + @Test + public void testCloseModalSubWindow() throws Exception { + + openTestURL(); + + // assert that there's a button with a 'del-btn0' id + List<WebElement> buttons = getDriver().findElements( + By.id(CloseModalSubWindow.DELETE_BUTTON + "0")); + int deleteButtonCount = buttons.size(); + Assert.assertEquals(1, deleteButtonCount); + + // assert that there's no sub-windows open + List<WebElement> subWindows = getDriver().findElements( + By.id(CloseModalSubWindow.SUB_WINDOW)); + Assert.assertEquals(0, subWindows.size()); + + // click the first delete button + getFirstDeteleButton(0).click(); + + // assert that there's ONE sub-window open + subWindows = getDriver().findElements( + By.id(CloseModalSubWindow.SUB_WINDOW)); + Assert.assertEquals(1, subWindows.size()); + + WebElement confirm = getDriver().findElement( + By.id(CloseModalSubWindow.CONFIRM_BUTTON)); + + // click the confirm button in the sub-window + confirm.click(); + + // assert that there's no sub-windows open + subWindows = getDriver().findElements( + By.id(CloseModalSubWindow.SUB_WINDOW)); + Assert.assertEquals(0, subWindows.size()); + + // assert that there's no button with 'del-btn0' id anymore + buttons = getDriver().findElements( + By.id(CloseModalSubWindow.DELETE_BUTTON + "0")); + Assert.assertEquals(0, buttons.size()); + } + + private WebElement getFirstDeteleButton(int index) { + WebElement button = getDriver().findElement( + By.id(CloseModalSubWindow.DELETE_BUTTON + index)); + return button; + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java index 6347ff9a76..b952df0ed9 100644 --- a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java index 665e175f2c..e65a24e907 100644 --- a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java +++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java index 39989926e7..c7379f666b 100644 --- a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java +++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.window; import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.window.WindowState.WindowRole; +import com.vaadin.shared.ui.window.WindowRole; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; diff --git a/uitest/src/com/vaadin/tests/components/window/ModalWindowNativeSelect.java b/uitest/src/com/vaadin/tests/components/window/ModalWindowNativeSelect.java index 2c6d3c942f..3713facaf0 100644 --- a/uitest/src/com/vaadin/tests/components/window/ModalWindowNativeSelect.java +++ b/uitest/src/com/vaadin/tests/components/window/ModalWindowNativeSelect.java @@ -29,4 +29,4 @@ public class ModalWindowNativeSelect extends TestBase { return 4261; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/window/MoveToTop.java b/uitest/src/com/vaadin/tests/components/window/MoveToTop.java index 4fd748183a..a5a4eb6df3 100644 --- a/uitest/src/com/vaadin/tests/components/window/MoveToTop.java +++ b/uitest/src/com/vaadin/tests/components/window/MoveToTop.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/MoveToTopTest.java b/uitest/src/com/vaadin/tests/components/window/MoveToTopTest.java index 26d7a06531..1700100ae7 100644 --- a/uitest/src/com/vaadin/tests/components/window/MoveToTopTest.java +++ b/uitest/src/com/vaadin/tests/components/window/MoveToTopTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java index 5a0e4d1370..99aa15b47d 100644 --- a/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java +++ b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java @@ -55,4 +55,4 @@ public class RepaintWindowContents extends AbstractTestUI { return 8832; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java index 2f1c0ff685..403795b676 100644 --- a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java +++ b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java index b6474519b0..9a3ccb3b31 100644 --- a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java +++ b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html b/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html deleted file mode 100644 index 2c3f651e41..0000000000 --- a/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html +++ /dev/null @@ -1,52 +0,0 @@ -<?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>SubWindowWithUndefinedHeight</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">SubWindowWithUndefinedHeight</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.SubWindowWithUndefinedHeight?restartApplication</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>initial-tab1</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td>17,13</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>select-tab2</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>8,9</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>select-tab1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeightTest.java b/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeightTest.java new file mode 100644 index 0000000000..ec86f62a7c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeightTest.java @@ -0,0 +1,41 @@ +/* + * 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.components.window; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TabSheetElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class SubWindowWithUndefinedHeightTest extends MultiBrowserTest { + + @Test + public void testUndefinedWindowSizeUpdate() throws IOException { + openTestURL(); + + $(ButtonElement.class).caption("click me").first().click(); + compareScreen("initial-tab1"); + + $(TabSheetElement.class).first().openTab("tab 2"); + compareScreen("select-tab2"); + + $(TabSheetElement.class).first().openTab("Tab 1"); + compareScreen("select-tab1"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java index 2e0873956c..335590437d 100644 --- a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java index 02ec0c047b..9730d1d8a1 100644 --- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java index 0e11041e3b..6f144ef7a4 100644 --- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java +++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContent.java b/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContent.java index 720f751cef..0915b93c26 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContent.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java b/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java index 8378c8cf7b..ab247be25b 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowInUiWithNoContentTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java index e0bc0d9471..63aebebdad 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java @@ -64,4 +64,4 @@ public class WindowMoveListener extends AbstractTestUI { return 12885; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java index 3ea3b719c0..5502bf0495 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java @@ -47,4 +47,4 @@ public class WindowMoveListenerTest extends MultiBrowserTest { window.getLocation().y); } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowThemes.java b/uitest/src/com/vaadin/tests/components/window/WindowThemes.java index 2b39916db8..788adc7902 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowThemes.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowThemes.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 diff --git a/uitest/src/com/vaadin/tests/components/window/WindowZIndexTest.java b/uitest/src/com/vaadin/tests/components/window/WindowZIndexTest.java index 38254cf6f3..dc2dfca4f0 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowZIndexTest.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowZIndexTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 Vaadin Ltd. + * 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 |