Author: konstantin.mishin
Date: 2008-10-09 10:36:29 -0400 (Thu, 09 Oct 2008)
New Revision: 10704
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/listShuttle/listShuttleTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
Log:
'sourceRequired' and 'targetRequired' attributes work
Check "sourceCaption" and "targetCaption" facets
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java 2008-10-09
11:57:25 UTC (rev 10703)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ListShuttleBean.java 2008-10-09
14:36:29 UTC (rev 10704)
@@ -11,11 +11,18 @@
private List<ListShuttleItem> items = null;
private List<ListShuttleItem> freeItems = null;
private boolean controlsVisible = true;
+
+ private boolean sourceRequired;
+ private boolean targetRequired;
+
+
public ListShuttleBean() {
init();
}
- private void init() {
+ public void init() {
+ sourceRequired = false;
+ targetRequired = false;
items = new ArrayList<ListShuttleItem>();
freeItems = new ArrayList<ListShuttleItem>();
for (int i = 0; i < 5; i++) {
@@ -61,4 +68,20 @@
public void setControlsVisible(boolean controlsVisible) {
this.controlsVisible = controlsVisible;
}
+
+ public boolean getSourceRequired() {
+ return sourceRequired;
+ }
+
+ public void setSourceRequired(boolean sourceRequired) {
+ this.sourceRequired = sourceRequired;
+ }
+
+ public boolean getTargetRequired() {
+ return targetRequired;
+ }
+
+ public void setTargetRequired(boolean targetRequired) {
+ this.targetRequired = targetRequired;
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/listShuttle/listShuttleTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2008-10-09
11:57:25 UTC (rev 10703)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2008-10-09
14:36:29 UTC (rev 10704)
@@ -14,6 +14,8 @@
*/
public class ListShuttleTest extends SeleniumTestBase {
+ private String initMethod = "#{listShuttle.init}";
+
String parentId;
String availebleListId;
@@ -42,7 +44,16 @@
String hideId;
- private void init() {
+ String msgId;
+
+ String reqFormId;
+
+ String sourceRequiredId;
+
+ String targetRequiredId;
+
+ private void init(Template template) {
+ renderPage(template, initMethod);
parentId = getParentId() + "_form:";
availebleListId = parentId + "lstbody";
targetListId = parentId + "lstlTbody";
@@ -57,15 +68,54 @@
submitId = parentId + "submit";
resetId = parentId + "reset";
hideId = parentId + "hide";
+ msgId = getParentId() + "msgId";
+ reqFormId = getParentId() + "reqFormId";
+ sourceRequiredId = reqFormId + ":sourceRequiredId";
+ targetRequiredId = reqFormId + ":targetRequiredId";
+ }
+ /**
+ * 'sourceRequired' and 'targetRequired' attributes work
+ */
+ @Test
+ public void testSourceRequiredAndTargetRequired(Template template) {
+ init(template);
+ Assert.assertFalse(selenium.isElementPresent(msgId), "Message mustn't be
rendered.");
+
+ selenium.click(targetRequiredId);
+ waitForAjaxCompletion();
+ clickAjaxCommandAndWait(submitId);
+ Assert.assertTrue(selenium.isElementPresent(msgId), "Message must be
rendered. Target list is empty.");
+ clickById(copyAllId);
+ clickAjaxCommandAndWait(submitId);
+ Assert.assertFalse(selenium.isElementPresent(msgId), "Message mustn't be
rendered.");
+
+ selenium.click(targetRequiredId);
+ waitForAjaxCompletion();
+
+ selenium.click(sourceRequiredId);
+ waitForAjaxCompletion();
+ clickAjaxCommandAndWait(submitId);
+ Assert.assertTrue(selenium.isElementPresent(msgId), "Message must be
rendered. Source list is empty.");
+ clickById(removeAllId);
+ clickAjaxCommandAndWait(submitId);
+ Assert.assertFalse(selenium.isElementPresent(msgId), "Message mustn't be
rendered.");
}
+ /**
+ * Check "sourceCaption" and "targetCaption" facets
+ */
@Test
+ public void testSourceCaptionAndTargetCaption(Template template) {
+ init(template);
+ Assert.assertTrue(selenium.isElementPresent(parentId +
"ls:sourceCaptionId"), "Facet 'sourceCaption' must be
rendered.");
+ Assert.assertTrue(selenium.isElementPresent(parentId +
"ls:targetCaptionId"), "Facet 'targetCaption' must be
rendered.");
+ }
+
+ @Test
public void testListShuttleComponent(Template template) {
- renderPage(template);
- init();
- reset();
-
+ init(template);
+
_checkVisibility(true);
// Check count
@@ -178,10 +228,6 @@
}
}
- private void reset() {
- clickAjaxCommandAndWait(resetId);
- }
-
private void _assertTableRowsCount(String tbId, int rows) {
writeStatus("Check items count for list id : " + tbId);
StringBuffer b = new StringBuffer("$('");
Show replies by date