diff options
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStates.java | 57 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStatesTest.java | 19 |
2 files changed, 76 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStates.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStates.java new file mode 100644 index 0000000000..aae4a213c6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStates.java @@ -0,0 +1,57 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.PopupDateField; + +@SuppressWarnings("serial") +public class PopupDateFieldStates extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final GridLayout gridLayout = new GridLayout(2, 2); + gridLayout.setSpacing(true); + + gridLayout.addComponent(createPopupDateField(true, true)); + gridLayout.addComponent(createPopupDateField(true, false)); + gridLayout.addComponent(createPopupDateField(false, true)); + gridLayout.addComponent(createPopupDateField(false, false)); + + getLayout().addComponent(gridLayout); + } + + @Override + protected String getTestDescription() { + return "Test that PopupDateField is rendered consistently across browsers"; + } + + @Override + protected Integer getTicketNumber() { + return 14565; + } + + private static PopupDateField createPopupDateField(final boolean enabled, + final boolean textFieldEnabled) { + final PopupDateField popupDatefield = new PopupDateField(); + + Calendar cal = GregorianCalendar.getInstance(); + cal.set(Calendar.DATE, 3); + cal.set(Calendar.MONTH, Calendar.SEPTEMBER); + cal.set(Calendar.YEAR, 2014); + cal.set(Calendar.HOUR_OF_DAY, 8); + final Date currentDate = cal.getTime(); + + popupDatefield.setValue(currentDate); + popupDatefield.setCaption("Enabled: " + enabled + + ", Text field enabled: " + textFieldEnabled); + popupDatefield.setEnabled(enabled); + popupDatefield.setTextFieldEnabled(textFieldEnabled); + return popupDatefield; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStatesTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStatesTest.java new file mode 100644 index 0000000000..8c5ba20ecc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldStatesTest.java @@ -0,0 +1,19 @@ +package com.vaadin.tests.components.datefield; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class PopupDateFieldStatesTest extends MultiBrowserTest { + + @Test + public void readOnlyDateFieldPopupShouldNotOpen() throws IOException, + InterruptedException { + openTestURL(); + + compareScreen("dateFieldStates"); + } + +} |