diff options
author | John Ahlroos <john@vaadin.com> | 2013-08-09 10:59:11 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-08-09 08:31:47 +0000 |
commit | c7a48ae008d0c2a168635b863fe2e44d708c4b02 (patch) | |
tree | e19f44b27490008b7298f618d060fa459475a5cf /uitest | |
parent | 4f3e81a8db20c780c3c4733627be1793fb17921a (diff) | |
download | vaadin-framework-c7a48ae008d0c2a168635b863fe2e44d708c4b02.tar.gz vaadin-framework-c7a48ae008d0c2a168635b863fe2e44d708c4b02.zip |
Delay sending DateField popup value to server until popup is closed #6252
Change-Id: Ib6f4681ea38fe7a6cac8a44bc4ab4b23151844dd
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.html | 107 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java | 112 |
2 files changed, 219 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.html b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.html new file mode 100644 index 0000000000..18f0ce0da2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.html @@ -0,0 +1,107 @@ +<?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:7171/" /> +<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.datefield.PopupDateFieldValueChangeEvents?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>12,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[3]/span</td> + <td>18,12</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]/domChild[0]</td> + <td>Value changes: 1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>12,11</td> +</tr> +<tr> + <td>select</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[3]/td/div/select</td> + <td>label=01</td> +</tr> +<tr> + <td>select</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[3]/td/div/select[2]</td> + <td>label=02</td> +</tr> +<tr> + <td>select</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[3]/td/div/select[3]</td> + <td>label=03</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[3]/td/div/select[3]</td> + <td>enter</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>410,9</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]/domChild[0]</td> + <td>Value changes: 2</td> +</tr> +<tr> + <td>select</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VNativeSelect[0]/domChild[0]</td> + <td>label=MONTH</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> + <td>14,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[4]</td> + <td>3,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[5]</td> + <td>9,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>xpath=(//button[@type='button'])[4]</td> + <td>7,8</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>xpath=(//button[@type='button'])[4]</td> + <td>enter</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldValueChangeEvents::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]/domChild[0]</td> + <td>Value changes: 3</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java new file mode 100644 index 0000000000..b875d86428 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldValueChangeEvents.java @@ -0,0 +1,112 @@ +/* + * Copyright 2000-2013 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.datefield; + +import java.util.Arrays; +import java.util.Calendar; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.NativeSelect; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class PopupDateFieldValueChangeEvents extends AbstractTestUI { + + private int count = 0; + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + + HorizontalLayout hl = new HorizontalLayout(); + addComponent(hl); + + Calendar calendar = Calendar.getInstance(); + calendar.set(2010, 1, 1, 18, 19, 20); + + final DateField df = new DateField(null, calendar.getTime()); + df.setResolution(Resolution.SECOND); + df.setImmediate(true); + hl.addComponent(df); + + NativeSelect resolution = new NativeSelect(null, + Arrays.asList(Resolution.values())); + resolution.setImmediate(true); + resolution.setValue(df.getResolution()); + hl.addComponent(resolution); + resolution.addValueChangeListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + df.setResolution((Resolution) event.getProperty().getValue()); + } + }); + + final Label log = new Label("", ContentMode.PREFORMATTED); + addComponent(log); + + df.addValueChangeListener(new Property.ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + log.setValue("Value changes: " + (++count)); + + } + }); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "DateField Time resolution fields should only send events when focus is removed"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 6252; + } + +} |