diff options
author | denis.magdenkov <denis.magdenkov@arcadia.spb.ru> | 2014-09-10 15:14:57 +0400 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-12 16:55:51 +0300 |
commit | 729448fb19dc318149a4c12d160d50e1f780fd09 (patch) | |
tree | 897dcd8ec75073aa6c442f8bf5c013c87b171962 /uitest | |
parent | 51b6c263cb2076bcc07f366bac966536448a5d3c (diff) | |
download | vaadin-framework-729448fb19dc318149a4c12d160d50e1f780fd09.tar.gz vaadin-framework-729448fb19dc318149a4c12d160d50e1f780fd09.zip |
TextFields inside Drag and Drop Wrappers cannot get focus (#12838)
Add detection logic to distinguish bweteen click and drag.
Change-Id: I43129183e990266243bfaafe83396f52b09b16d4
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java | 55 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java | 52 |
2 files changed, 107 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java new file mode 100644 index 0000000000..c182894db4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java @@ -0,0 +1,55 @@ +/* + * 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 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 inside {@link DragAndDropWrapper}: text area should + * obtain focus on click. + * + * @since + * @author Vaadin Ltd + */ +public class DragAndDropFocusObtain 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.COMPONENT); + addComponent(wrapper); + } + + @Override + protected String getTestDescription() { + return "Text fields/areas inside Drag and Drop Wrappers should get focus inside DnD wrapper on click."; + } + + @Override + protected Integer getTicketNumber() { + return 12838; + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java new file mode 100644 index 0000000000..ccb28b7103 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtainTest.java @@ -0,0 +1,52 @@ +/* + * 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 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; +import com.vaadin.ui.DragAndDropWrapper; + +/** + * Test for text area inside {@link DragAndDropWrapper}: text area should obtain + * focus on click. + * + * @since + * @author Vaadin Ltd + */ +public class DragAndDropFocusObtainTest extends MultiBrowserTest { + + @Test + public void testTextAreaDndImage() { + openTestURL(); + + WebElement wrapper = driver.findElement(By.className("v-ddwrapper")); + Actions actions = new Actions(driver); + actions.click(wrapper); + actions.perform(); + + WebElement focusedElement = driver.findElement(By + .className("v-textarea-focus")); + Assert.assertNotNull("Text area did not obtain focus after click", + focusedElement); + + } + +} |