aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--all/src/main/templates/release-notes.html1
-rw-r--r--client/src/main/java/com/vaadin/client/VTooltip.java1
-rw-r--r--compatibility-themes/src/main/themes/VAADIN/themes/base/common/common.scss5
m---------tests/screenshots0
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss5
-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
10 files changed, 128 insertions, 4 deletions
diff --git a/all/src/main/templates/release-notes.html b/all/src/main/templates/release-notes.html
index d7546701ec..44b1690e7b 100644
--- a/all/src/main/templates/release-notes.html
+++ b/all/src/main/templates/release-notes.html
@@ -105,6 +105,7 @@
<li>The <tt>HierarchicalDataProvider</tt> interface replaces <tt>Container.Hierarchical</tt> and <<tt>InMemoryHierarchicalDataProvider</tt> replaces <tt>HierarchicalContainer</tt></li>
<li>The <tt>DragSourceExtension</tt> and <tt>DropTargetExtension</tt> extensions replace the old DnD features</li>
<li>OSGi bundle manifests of Vaadin Framework JARs no longer export <tt>/VAADIN</tt>, and there are new mechanisms for publishing static resources for OSGi</li>
+ <li>Tooltip styles for <tt>ContentMode.PREFORMATTED</tt> have been changed in all built-in themes to use the application font and allow long lines to wrap to multiple lines.</li>
<h2>For incompatible or behaviour-altering changes in 8.0, please see <a href="https://vaadin.com/download/release/8.0/8.0.0/release-notes.html#incompatible">8.0 release notes</a></h2>
diff --git a/client/src/main/java/com/vaadin/client/VTooltip.java b/client/src/main/java/com/vaadin/client/VTooltip.java
index b9fbfa1470..7cbd951114 100644
--- a/client/src/main/java/com/vaadin/client/VTooltip.java
+++ b/client/src/main/java/com/vaadin/client/VTooltip.java
@@ -153,6 +153,7 @@ public class VTooltip extends VOverlay {
break;
case PREFORMATTED:
PreElement preElement = Document.get().createPreElement();
+ preElement.addClassName(CLASSNAME + "-pre");
preElement.setInnerText(info.getTitle());
// clear existing content
description.setHTML("");
diff --git a/compatibility-themes/src/main/themes/VAADIN/themes/base/common/common.scss b/compatibility-themes/src/main/themes/VAADIN/themes/base/common/common.scss
index 4e6381aad7..f24daca2ca 100644
--- a/compatibility-themes/src/main/themes/VAADIN/themes/base/common/common.scss
+++ b/compatibility-themes/src/main/themes/VAADIN/themes/base/common/common.scss
@@ -129,6 +129,11 @@ body &.v-app .v-app-loading {
cursor: default;
background: #fff;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .5);
+
+ pre.v-tooltip-pre {
+ font: inherit;
+ white-space: pre-wrap;
+ }
}
.v-tooltip-text {
overflow: auto;
diff --git a/tests/screenshots b/tests/screenshots
-Subproject a79dd59a14d88413fbfe80071130f3271152aaf
+Subproject 03a4ef619539700a7bdc9be528cd8e8ad850325
diff --git a/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss b/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
index ff5e855b66..cb3824d26f 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
@@ -119,6 +119,11 @@ $v-tooltip-border-radius: $v-border-radius - 1px !default;
h4 {
color: inherit;
}
+
+ pre.v-tooltip-pre {
+ font: inherit;
+ white-space: pre-wrap;
+ }
}
}
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