diff options
author | Artur Signell <artur@vaadin.com> | 2013-03-25 21:54:36 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-04-03 06:42:36 +0000 |
commit | 9586a30b64bfd1e8645574d9d7b6568d52dc9e25 (patch) | |
tree | a26ec723ebac47fd78b6180bc41434029a502aaf /uitest/src/com/vaadin | |
parent | 3cc90e37d8abfa53d127691ae0b7641298d64fa2 (diff) | |
download | vaadin-framework-9586a30b64bfd1e8645574d9d7b6568d52dc9e25.tar.gz vaadin-framework-9586a30b64bfd1e8645574d9d7b6568d52dc9e25.zip |
Made is possible to configure tooltip on the server (#8065)
Change-Id: I35af6df1dfa75ef1de1268eb630fc0f4b9306170
Diffstat (limited to 'uitest/src/com/vaadin')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html | 135 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java | 107 |
2 files changed, 242 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html new file mode 100644 index 0000000000..5170d4408f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html @@ -0,0 +1,135 @@ +<?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="http://localhost:8888/" /> +<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.ui.TooltipConfiguration?restartApplication</td> + <td></td> +</tr> +<!--Short close delay--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>0</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>id=gwt-uid-3</td> + <td>This is a short tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<!--Long close delay--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>3000</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>id=gwt-uid-3</td> + <td>This is a short tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>60,9</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td> + <td>0</td> +</tr> +<!--Max width 500--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<tr> + <td>assertElementWidth</td> + <td>id=gwt-uid-3</td> + <td>500</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td> + <td></td> +</tr> +<!--Max width 100--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SMax width</td> + <td>100</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td> + <td>0,0</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>id=gwt-uid-3</td> + <td></td> +</tr> +<tr> + <td>assertElementWidth</td> + <td>id=gwt-uid-3</td> + <td>100</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java new file mode 100644 index 0000000000..b8998ff32e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java @@ -0,0 +1,107 @@ +package com.vaadin.tests.components.ui; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.util.LoremIpsum; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.TextField; + +public class TooltipConfiguration extends AbstractTestUIWithLog { + + private TextField closeTimeout; + private TextField quickOpenTimeout; + private TextField maxWidth; + private TextField openDelay; + private TextField quickOpenDelay; + + @Override + protected void setup(VaadinRequest request) { + NativeButton componentWithShortTooltip = new NativeButton( + "Short tooltip"); + componentWithShortTooltip.setDescription("This is a short tooltip"); + componentWithShortTooltip.setId("shortTooltip"); + + NativeButton componentWithLongTooltip = new NativeButton("Long tooltip"); + componentWithLongTooltip.setId("longTooltip"); + componentWithLongTooltip.setDescription(LoremIpsum.get(5000)); + + closeTimeout = createIntegerTextField("Close timeout", + getState().tooltipConfiguration.closeTimeout); + closeTimeout.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setCloseTimeout( + (Integer) closeTimeout.getConvertedValue()); + } + }); + maxWidth = createIntegerTextField("Max width", + getState().tooltipConfiguration.maxWidth); + maxWidth.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip() + .setMaxWidth((Integer) maxWidth.getConvertedValue()); + } + }); + openDelay = createIntegerTextField("Open delay", + getState().tooltipConfiguration.openDelay); + openDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setOpenDelay( + (Integer) openDelay.getConvertedValue()); + } + }); + + quickOpenDelay = createIntegerTextField("Quick open delay", + getState().tooltipConfiguration.quickOpenDelay); + quickOpenDelay + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setQuickOpenDelay( + (Integer) quickOpenDelay.getConvertedValue()); + } + }); + + quickOpenTimeout = createIntegerTextField("Quick open timeout", + getState().tooltipConfiguration.quickOpenTimeout); + quickOpenTimeout + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setQuickOpenTimeout( + (Integer) quickOpenTimeout.getConvertedValue()); + } + }); + + getLayout().addComponents(closeTimeout, openDelay, quickOpenDelay, + quickOpenTimeout, maxWidth); + + getLayout().addComponents(componentWithShortTooltip, + componentWithLongTooltip); + + } + + private TextField createIntegerTextField(String caption, int initialValue) { + TextField tf = new TextField(caption); + tf.setId(caption); + tf.setConverter(Integer.class); + tf.setImmediate(true); + tf.setConvertedValue(initialValue); + return tf; + } + + @Override + protected String getTestDescription() { + return "Tests that tooltip delays can be configured"; + } + + @Override + protected Integer getTicketNumber() { + return 8065; + } + +} |