From dfcc4949ca445b55bc004ef96da8ae28aa343018 Mon Sep 17 00:00:00 2001 From: Pontus Boström Date: Fri, 20 Nov 2015 17:08:44 +0200 Subject: Fixed tooltips for sub-windows (#19073) The subwindows tooltip is now also shown in header and footer of the subwindow. Added also tests for the feature. Change-Id: I933dad9e8530ce20b930fe22caf9e79a3ad3e3d2 --- .../tests/components/window/ToolTipInWindow.java | 46 +++++++++++++ .../components/window/ToolTipInWindowTest.java | 77 ++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 uitest/src/main/java/com/vaadin/tests/components/window/ToolTipInWindow.java create mode 100644 uitest/src/test/java/com/vaadin/tests/components/window/ToolTipInWindowTest.java (limited to 'uitest') diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/ToolTipInWindow.java b/uitest/src/main/java/com/vaadin/tests/components/window/ToolTipInWindow.java new file mode 100644 index 0000000000..144b5a0d3f --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/window/ToolTipInWindow.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2015 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.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.Window; + +/** + * Test to demonstrate that tooltips are shown for both Window header and + * content + * + * @author Vaadin Ltd + */ +public class ToolTipInWindow extends AbstractTestUI { + + Window window; + + @Override + protected void setup(VaadinRequest request) { + + window = new Window("Caption", new Label("A label content")); + window.setPositionX(300); + window.setPositionY(200); + window.setWidth("200px"); + window.setHeight("200px"); + window.setDescription("Tooltip"); + addWindow(window); + + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/ToolTipInWindowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/ToolTipInWindowTest.java new file mode 100644 index 0000000000..40332e7730 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/window/ToolTipInWindowTest.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2015 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 static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; + +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 ToolTipInWindowTest extends MultiBrowserTest { + + @Test + public void testToolTipInHeader() throws Exception { + + openTestURL(); + + WebElement header = driver.findElement(By + .className("v-window-outerheader")); + new Actions(driver).moveToElement( + driver.findElement(By.className("v-ui")), 0, 0).perform(); + sleep(500); + new Actions(driver).moveToElement(header).perform(); + sleep(1100); + + WebElement ttip = findElement(By.className("v-tooltip")); + assertNotNull(ttip); + assertEquals("Tooltip", ttip.getText()); + + } + + @Test + public void testToolTipInContent() throws Exception { + + openTestURL(); + + WebElement header = driver.findElement(By + .className("v-window-contents")); + new Actions(driver).moveToElement( + driver.findElement(By.className("v-ui")), 0, 300).perform(); + sleep(500); + new Actions(driver).moveToElement(header).perform(); + sleep(1000); + + WebElement ttip = findElement(By.className("v-tooltip")); + assertNotNull(ttip); + assertEquals("Tooltip", ttip.getText()); + + } + + @Override + public List getBrowsersToTest() { + // Test with the same browsers as in the other tooltip tests + return getBrowsersExcludingIE(); + } + +} -- cgit v1.2.3