diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-09-14 16:42:06 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-09-14 16:42:06 +0000 |
commit | 14f4091791f91d28c3a827148f4af848642bc3bd (patch) | |
tree | f51e1d38ae881bb777413b02281af08142659d53 /tests | |
parent | 7c2e0239686f10c7a0c808ce3494bcf4074d6fe7 (diff) | |
download | vaadin-framework-14f4091791f91d28c3a827148f4af848642bc3bd.tar.gz vaadin-framework-14f4091791f91d28c3a827148f4af848642bc3bd.zip |
Fixed minor problems in test and added input prompt
svn changeset:14916/svn branch:6.4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/components/datefield/PopupDateFieldResolutions.html | 170 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/components/datefield/PopupDateFields.java | 44 |
2 files changed, 170 insertions, 44 deletions
diff --git a/tests/src/com/vaadin/tests/components/datefield/PopupDateFieldResolutions.html b/tests/src/com/vaadin/tests/components/datefield/PopupDateFieldResolutions.html index 4c36f3af2b..dd0c24bfca 100644 --- a/tests/src/com/vaadin/tests/components/datefield/PopupDateFieldResolutions.html +++ b/tests/src/com/vaadin/tests/components/datefield/PopupDateFieldResolutions.html @@ -350,44 +350,39 @@ <td>1970</td>
</tr>
<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>1971</td>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>37,12</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>1974</td>
+ <td>1971</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
<td>37,12</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
- <td>13,11</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>44,9</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>37,12</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
- <td>173,31</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>37,12</td>
</tr>
<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
- <td>12,10</td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>1974</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]/domChild[0]</td>
- <td>284,10</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
+ <td>37,12</td>
</tr>
<tr>
<td>assertValue</td>
@@ -410,6 +405,11 @@ <td>202,40</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>16,11</td>
@@ -420,20 +420,40 @@ <td>2010</td>
</tr>
<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>22,9</td>
+</tr>
+<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
<td>2009</td>
</tr>
<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>22,9</td>
+</tr>
+<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
<td>2010</td>
</tr>
<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>22,9</td>
+</tr>
+<tr>
<td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
<td>2011</td>
</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>129,26</td>
+</tr>
<!--Check resolution month functionality-->
<tr>
<td>select</td>
@@ -443,7 +463,7 @@ <tr>
<td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
- <td>5/10</td>
+ <td>5/11</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -453,17 +473,17 @@ <tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>May 2010</td>
+ <td>May 2011</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[2]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[3]</td>
<td>10,14</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>June 2010</td>
+ <td>June 2011</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -473,7 +493,7 @@ <tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
- <td>June 2011</td>
+ <td>June 2012</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -483,7 +503,7 @@ <tr>
<td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
- <td>6/11</td>
+ <td>6/12</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -496,6 +516,11 @@ <td>1/09</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>8,10</td>
@@ -507,8 +532,8 @@ </tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[2]</td>
- <td>13,9</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[3]</td>
+ <td>13,7</td>
</tr>
<tr>
<td>assertText</td>
@@ -525,6 +550,11 @@ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
<td>2/09</td>
</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>129,26</td>
+</tr>
<!--Check resolution day functionality-->
<tr>
<td>select</td>
@@ -532,11 +562,26 @@ <td>label=Day</td>
</tr>
<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
+ <td>5/23/70</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td>
+ <td>478,1</td>
+</tr>
+<tr>
<td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
<td>5/23/70</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>11,16</td>
@@ -548,12 +593,12 @@ </tr>
<tr>
<td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[22]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[8]</td>
<td>v-datefield-calendarpanel-day-selected</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[2]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[3]</td>
<td>11,11</td>
</tr>
<tr>
@@ -577,8 +622,13 @@ <td>193,12</td>
</tr>
<tr>
- <td>assertText</td>
+ <td>assertValue</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[0]</td>
+ <td>5/23/70</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>100</td>
<td></td>
</tr>
<tr>
@@ -612,11 +662,26 @@ <td>6/30/71</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>5,13</td>
</tr>
<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>June 1971</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[29]</td>
+ <td>v-datefield-calendarpanel-day-selected</td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/VCalendarPanel$VEventButton[3]</td>
<td>15,14</td>
@@ -632,6 +697,11 @@ <td>5/31/71</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>11,9</td>
@@ -652,6 +722,11 @@ <td>4/30/71</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>12,13</td>
@@ -663,7 +738,7 @@ </tr>
<tr>
<td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[0]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[29]</td>
<td>v-datefield-calendarpanel-day-selected</td>
</tr>
<tr>
@@ -673,7 +748,7 @@ </tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[0]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[29]</td>
<td>17,9</td>
</tr>
<tr>
@@ -682,6 +757,11 @@ <td>4/1/72</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>11,11</td>
@@ -693,7 +773,7 @@ </tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[29]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[0]</td>
<td>15,4</td>
</tr>
<tr>
@@ -702,6 +782,11 @@ <td>3/1/72</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>8,6</td>
@@ -713,7 +798,7 @@ </tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[27]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[0]</td>
<td>17,9</td>
</tr>
<tr>
@@ -732,6 +817,11 @@ <td>1/15/02</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>11,14</td>
@@ -743,7 +833,7 @@ </tr>
<tr>
<td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[13]</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[16]</td>
<td>v-datefield-calendarpanel-day-selected</td>
</tr>
<tr>
@@ -777,6 +867,11 @@ <td>1/15/02</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]/domChild[1]</td>
<td>8,7</td>
@@ -791,6 +886,11 @@ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::Root/VOverlay[0]/VCalendarPanel[0]/FlexTable[0]/VCalendarPanel$Day[14]</td>
<td>v-datefield-calendarpanel-day-selected</td>
</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>364,32</td>
+</tr>
</tbody></table>
</body>
</html>
diff --git a/tests/src/com/vaadin/tests/components/datefield/PopupDateFields.java b/tests/src/com/vaadin/tests/components/datefield/PopupDateFields.java index c49b0013fa..bafee0847c 100644 --- a/tests/src/com/vaadin/tests/components/datefield/PopupDateFields.java +++ b/tests/src/com/vaadin/tests/components/datefield/PopupDateFields.java @@ -62,7 +62,8 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { actions.add(createEnabledAction(true));
actions.add(createRequiredAction(false));
actions.add(createReadonlyAction(false));
- actions.add(createResolutionSelectAction(false));
+ actions.add(createResolutionSelectAction());
+ actions.add(createInputPromptSelectAction());
return actions;
}
@@ -106,7 +107,7 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { }
protected Component createRequiredAction(boolean initialState) {
- return createCheckboxAction("Readonly", initialState,
+ return createCheckboxAction("Required", initialState,
new Command<PopupDateField, Boolean>() {
public void execute(PopupDateField c, Boolean enabled) {
c.setRequired(enabled);
@@ -114,7 +115,7 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { });
}
- private Component createResolutionSelectAction(boolean b) {
+ private Component createResolutionSelectAction() {
LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
options.put("Year", DateField.RESOLUTION_YEAR);
options.put("Month", DateField.RESOLUTION_MONTH);
@@ -123,8 +124,7 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { options.put("Min", DateField.RESOLUTION_MIN);
options.put("Sec", DateField.RESOLUTION_SEC);
options.put("Msec", DateField.RESOLUTION_MSEC);
- return createSelectAction("Resolution", options,
- DateField.RESOLUTION_YEAR,
+ return createSelectAction("Resolution", options, "Year",
new Command<PopupDateField, Integer>() {
public void execute(PopupDateField c, Integer value) {
@@ -134,24 +134,50 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { });
}
+ private Component createInputPromptSelectAction() {
+ LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ options.put("<none>", null);
+ options.put("Please enter date", "Please enter date");
+ options.put("åäöÅÄÖ", "åäöÅÄÖ");
+
+ return createSelectAction("Input prompt", options, "<none>",
+ new Command<PopupDateField, String>() {
+
+ public void execute(PopupDateField c, String value) {
+ c.setInputPrompt(value);
+
+ }
+ });
+ }
+
private <T> Component createSelectAction(String caption,
- LinkedHashMap<String, T> options, int initialValue,
+ LinkedHashMap<String, T> options, String initialValue,
final Command<PopupDateField, T> command) {
final String CAPTION = "caption";
+ final String VALUE = "value";
- NativeSelect select = new NativeSelect(caption);
+ final NativeSelect select = new NativeSelect(caption);
select.addContainerProperty(CAPTION, String.class, "");
+ select.addContainerProperty(VALUE, Object.class, "");
select.setItemCaptionPropertyId(CAPTION);
select.setNullSelectionAllowed(false);
for (String itemCaption : options.keySet()) {
- Item i = select.addItem(options.get(itemCaption));
+ Object itemId = new Object();
+ Item i = select.addItem(itemId);
i.getItemProperty(CAPTION).setValue(itemCaption);
+ i.getItemProperty(VALUE).setValue(options.get(itemCaption));
+ if (itemCaption.equals(initialValue)) {
+ select.setValue(itemId);
+ }
}
select.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- doCommand(command, (T) event.getProperty().getValue());
+ Object itemId = event.getProperty().getValue();
+ Item item = select.getItem(itemId);
+ T value = (T) item.getItemProperty(VALUE).getValue();
+ doCommand(command, value);
}
});
|