summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <legioth@gmail.com>2017-05-15 11:44:24 +0300
committerHenri Sara <henri.sara@gmail.com>2017-05-15 11:44:24 +0300
commit6cfd4ed55a1f8e5defa6ef42e6c666966aca584b (patch)
tree5dfe42e91f947a34442d5cd1f6d2e7b3805dc0cc /uitest
parent8949b2def6000c648974cbe6c24753711e84ad87 (diff)
downloadvaadin-framework-6cfd4ed55a1f8e5defa6ef42e6c666966aca584b.tar.gz
vaadin-framework-6cfd4ed55a1f8e5defa6ef42e6c666966aca584b.zip
Use theme font and normal line wrapping for regular tooltips (#9143)
Fixes #9121
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/TooltipPosition.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipStyling.java50
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java3
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipStylingTest.java56
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java8
5 files changed, 116 insertions, 4 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/TooltipPosition.java b/uitest/src/main/java/com/vaadin/tests/components/TooltipPosition.java
index ea00b238ba..b638ad07aa 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/TooltipPosition.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/TooltipPosition.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.components;
import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ContentMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
@@ -44,7 +45,7 @@ public class TooltipPosition extends AbstractReindeerTestUI {
addComponent(layout);
for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
Button button = new Button("Button");
- button.setDescription(generateTooltipText());
+ button.setDescription(generateTooltipText(), ContentMode.HTML);
layout.addComponent(button);
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipStyling.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipStyling.java
new file mode 100644
index 0000000000..e1fb452c59
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipStyling.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2016 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.abstractcomponent;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ContentMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+
+public class TooltipStyling extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Label defaultLabel = new Label(
+ "I have a tooltip with default settings");
+ defaultLabel.setDescription(
+ "This long description should be shown with the application's default font and wrap to several lines as needed."
+ + "\n\nThis part should be on a separate line");
+ defaultLabel.setId("default");
+ addComponent(defaultLabel);
+
+ Label htmlLabel = new Label("I have a tooltip with HTML contents");
+ htmlLabel.setDescription(
+ "This is regular text in a tooltip."
+ + "<pre>This is a pre tag inside a HTML tooltip. It should use a monospace font and by default not break to multiple lines.</pre>",
+ ContentMode.HTML);
+ htmlLabel.setId("html");
+ addComponent(htmlLabel);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tooltips should be shown with the regular application font and automatically wrap to multiple lines for long contents.<br />"
+ + "&lt;pre> tag contents in a HTML tooltip should still behave according to browser defaults.";
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java
index e3efd7943e..489d7e2470 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipModesTest.java
@@ -36,7 +36,8 @@ public class TooltipModesTest extends TooltipTest {
$(ButtonElement.class).first().showTooltip();
// preformatted is default
- checkTooltip("<pre>Several\n lines\n tooltip</pre>");
+ checkTooltip(
+ "<pre class=\"v-tooltip-pre\">Several\n lines\n tooltip</pre>");
// Use html inside tooltip
$(ButtonElement.class).get(1).click();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipStylingTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipStylingTest.java
new file mode 100644
index 0000000000..6817e8c0d4
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/abstractcomponent/TooltipStylingTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2000-2016 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.abstractcomponent;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserThemeTest;
+import com.vaadin.tests.tb3.ParameterizedTB3Runner;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+@RunWith(ParameterizedTB3Runner.class)
+public class TooltipStylingTest extends SingleBrowserTest {
+
+ private String theme;
+
+ public void setTheme(String theme) {
+ this.theme = theme;
+ }
+
+ @Parameters
+ public static Collection<String> getThemes() {
+ return MultiBrowserThemeTest.themesToTest;
+ }
+
+ @Test
+ public void tooltipStyling() throws IOException {
+ openTestURL("theme=" + theme);
+
+ $(LabelElement.class).id("default").showTooltip();
+
+ compareScreen("default");
+
+ $(LabelElement.class).id("html").showTooltip();
+
+ compareScreen("html");
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
index 261af495fa..957dfd035e 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
@@ -17,6 +17,7 @@ package com.vaadin.tests.tb3;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -31,6 +32,10 @@ import org.openqa.selenium.remote.DesiredCapabilities;
@RunWith(ParameterizedTB3Runner.class)
public abstract class MultiBrowserThemeTest extends MultiBrowserTest {
+ public static final List<String> themesToTest = Collections
+ .unmodifiableList(Arrays.asList(new String[] { "valo", "reindeer",
+ "runo", "chameleon", "base" }));
+
private String theme;
public void setTheme(String theme) {
@@ -39,8 +44,7 @@ public abstract class MultiBrowserThemeTest extends MultiBrowserTest {
@Parameters
public static Collection<String> getThemes() {
- return Arrays.asList(new String[] { "valo", "reindeer", "runo",
- "chameleon", "base" });
+ return themesToTest;
}
@Override