diff options
author | Juuso Valli <juuso@vaadin.com> | 2014-06-18 15:10:28 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-06-23 07:40:52 +0000 |
commit | 7f769ec77d52aecbbf9d4787ab2e482d3b31a2af (patch) | |
tree | d45dd62fa3d353c662fca3986f0a10a3d67f3429 | |
parent | 0c229ae91460fedaeb557bdc5a646433658b0dfb (diff) | |
download | vaadin-framework-7f769ec77d52aecbbf9d4787ab2e482d3b31a2af.tar.gz vaadin-framework-7f769ec77d52aecbbf9d4787ab2e482d3b31a2af.zip |
Fix regression with DnD tooltips (#7766)
Change-Id: I74e6c35ef0aa30dbb24301bfb5858cedd0008e71
-rw-r--r-- | client/src/com/vaadin/client/TooltipInfo.java | 6 | ||||
-rw-r--r-- | client/src/com/vaadin/client/VTooltip.java | 14 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html | 53 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java (renamed from uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java) | 16 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java | 44 |
5 files changed, 63 insertions, 70 deletions
diff --git a/client/src/com/vaadin/client/TooltipInfo.java b/client/src/com/vaadin/client/TooltipInfo.java index 06940536c8..c1dd5037eb 100644 --- a/client/src/com/vaadin/client/TooltipInfo.java +++ b/client/src/com/vaadin/client/TooltipInfo.java @@ -15,6 +15,8 @@ */ package com.vaadin.client; +import com.vaadin.shared.util.SharedUtil; + public class TooltipInfo { private String title; @@ -79,7 +81,7 @@ public class TooltipInfo { } public boolean equals(TooltipInfo other) { - return (other != null && other.title == title - && other.errorMessageHtml == errorMessageHtml && other.identifier == identifier); + return (other != null && SharedUtil.equals(other.title, title) + && SharedUtil.equals(other.errorMessageHtml, errorMessageHtml) && other.identifier == identifier); } } diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index 4db4477caa..d1a2c395f7 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -22,13 +22,13 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.DomEvent; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; +import com.google.gwt.event.dom.client.MouseDownEvent; +import com.google.gwt.event.dom.client.MouseDownHandler; import com.google.gwt.event.dom.client.MouseMoveEvent; import com.google.gwt.event.dom.client.MouseMoveHandler; import com.google.gwt.user.client.DOM; @@ -337,7 +337,7 @@ public class VTooltip extends VWindowOverlay { } private class TooltipEventHandler implements MouseMoveHandler, - ClickHandler, KeyDownHandler, FocusHandler, BlurHandler { + KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler { /** * Current element hovered @@ -403,7 +403,7 @@ public class VTooltip extends VWindowOverlay { } @Override - public void onClick(ClickEvent event) { + public void onMouseDown(MouseDownEvent event) { handleHideEvent(); } @@ -449,9 +449,9 @@ public class VTooltip extends VWindowOverlay { // TooltipInfo contains a reference to the parent component that is // checked in it's equals-method. if (currentElement != null && isTooltipOpen()) { - TooltipInfo currentTooltip = getTooltipFor(currentElement); TooltipInfo newTooltip = getTooltipFor(element); - if (currentTooltip != null && currentTooltip.equals(newTooltip)) { + if (currentTooltipInfo != null + && currentTooltipInfo.equals(newTooltip)) { return; } } @@ -498,7 +498,7 @@ public class VTooltip extends VWindowOverlay { public void connectHandlersToWidget(Widget widget) { Profiler.enter("VTooltip.connectHandlersToWidget"); widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType()); - widget.addDomHandler(tooltipEventHandler, ClickEvent.getType()); + widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType()); widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType()); widget.addDomHandler(tooltipEventHandler, FocusEvent.getType()); widget.addDomHandler(tooltipEventHandler, BlurEvent.getType()); diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html deleted file mode 100644 index 3c91c8b24f..0000000000 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html +++ /dev/null @@ -1,53 +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.draganddropwrapper.DragAndDropWrapperTooltips?restartApplication</td> - <td></td> -</tr> -<tr> - <td>showTooltip</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper3/VLabel[0]</td> - <td>0,0</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltip-initial</td> -</tr> -<!--Drag Block 4 between Block 1 and Block 2--> -<tr> - <td>drag</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper4/VLabel[0]</td> - <td>30,41</td> -</tr> -<tr> - <td>drop</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper2</td> - <td>4,42</td> -</tr> -<tr> - <td>showTooltip</td> - <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper1/VLabel[0]</td> - <td>0,0</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>tooltip-after-drag</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java index f0010acce8..606a773141 100644 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java +++ b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java @@ -1,4 +1,4 @@ -package com.vaadin.tests.components.draganddropwrapper; +package com.vaadin.tests.tooltip; import java.util.Iterator; @@ -10,7 +10,8 @@ import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.TargetDetails; import com.vaadin.event.dd.acceptcriteria.AcceptAll; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.util.TestUtils; import com.vaadin.ui.Component; import com.vaadin.ui.CssLayout; @@ -18,7 +19,7 @@ import com.vaadin.ui.DragAndDropWrapper; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; -public class DragAndDropWrapperTooltips extends TestBase { +public class DragAndDropWrapperTooltips extends AbstractTestUI { private final String BASE = ".v-widget.greenblock {vertical-align: middle; float:left; width:60px;height:60px;background: green !important; padding:0; margin:2px;-webkit-transition: width 0.3s ease-in-out;color: white;}"; private final String B2 = ".v-widget.b2 {background-color: red !important;}"; @@ -28,9 +29,8 @@ public class DragAndDropWrapperTooltips extends TestBase { private DragAndDropWrapper dragAndDropWrapper; @Override - protected void setup() { - TestUtils.injectCSS(getMainWindow(), BASE + B4 + B2 + B3 - + HIDEDRAGSOURCE); + protected void setup(VaadinRequest request) { + TestUtils.injectCSS(this, BASE + B4 + B2 + B3 + HIDEDRAGSOURCE); VerticalLayout l = new VerticalLayout(); l.setWidth("400px"); @@ -49,7 +49,7 @@ public class DragAndDropWrapperTooltips extends TestBase { wl.addStyleName("b" + i); cssLayout.addComponent(wl); } - + getTooltipConfiguration().setOpenDelay(300); } int count; @@ -123,7 +123,7 @@ public class DragAndDropWrapperTooltips extends TestBase { }; @Override - protected String getDescription() { + protected String getTestDescription() { return "A tooltip should be shown when hovering the DragAndDropWrapper containing all the draggable layouts"; } diff --git a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java new file mode 100644 index 0000000000..d913c8cc12 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java @@ -0,0 +1,44 @@ +/* + * 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.tooltip; + +import org.junit.Test; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.TooltipTest; + +/** + * + * + * @author Vaadin Ltd + */ +public class DragAndDropWrapperTooltipsTest extends TooltipTest { + @Test + public void testDragAndDropTooltips() throws Exception { + openTestURL(); + LabelElement element = $(LabelElement.class).get(4); + LabelElement targetElement = $(LabelElement.class).get(1); + checkTooltip(element, + "Tooltip for the wrapper wrapping all the draggable layouts"); + new Actions(getDriver()).clickAndHold(element) + .moveToElement(targetElement).perform(); + sleep(500); + checkTooltipNotPresent(); + new Actions(getDriver()).release().perform(); + checkTooltip(element, "Drag was performed and tooltip was changed"); + } +} |