Author: dsvyatobatsko
Date: 2008-10-06 13:25:49 -0400 (Mon, 06 Oct 2008)
New Revision: 10673
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
Log:
PanelMenu: expandMode and mode apply to all nested components if not overriden
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-10-06
16:30:08 UTC (rev 10672)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-10-06
17:25:49 UTC (rev 10673)
@@ -24,75 +24,101 @@
import javax.faces.event.ActionEvent;
public class RichPanelTestBean {
- private String value;
- private int value2;
- private Object panelValue;
- private Object panelValue2;
-
- public RichPanelTestBean() {
- value = "";
- value2 = 0;
- }
+ private String value;
- public String getValue() {
- return value;
- }
+ private int value2;
- public void setValue(String value) {
- this.value = value;
- }
-
- public void actionListener(ActionEvent event) {
- this.value = event.getComponent().getId();
- }
-
- public String action1() {
- this.value2 = 1;
- return null;
- }
-
- public String action2() {
- this.value2 = 2;
- return null;
- }
-
- public String increment() {
- if (4 == this.value2) {
- this.value2 = 0;
- }
- this.value2++;
- return null;
- }
+ private Object panelValue;
- public int getValue2() {
- return value2;
- }
+ private Object panelValue2;
- public void setValue2(int value2) {
- this.value2 = value2;
- }
-
- public Object getPanelValue() {
- return panelValue;
- }
+ private String itemAction;
- public void setPanelValue(Object panelValue) {
- this.panelValue = panelValue;
- }
+ public RichPanelTestBean() {
+ value = "";
+ value2 = 0;
+ }
- public void cleanValues(ActionEvent event) {
- value = "";
- value2 = 0;
- panelValue = null;
- panelValue2 = null;
- }
+ public String getValue() {
+ return value;
+ }
- public Object getPanelValue2() {
- return panelValue2;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
- public void setPanelValue2(Object panelValue2) {
- this.panelValue2 = panelValue2;
- }
+ public int getValue2() {
+ return value2;
+ }
+ public void setValue2(int value2) {
+ this.value2 = value2;
+ }
+
+ public Object getPanelValue() {
+ return panelValue;
+ }
+
+ public void setPanelValue(Object panelValue) {
+ this.panelValue = panelValue;
+ }
+
+ public Object getPanelValue2() {
+ return panelValue2;
+ }
+
+ public void setPanelValue2(Object panelValue2) {
+ this.panelValue2 = panelValue2;
+ }
+
+ /**
+ * Gets value of itemAction field.
+ *
+ * @return value of itemAction field
+ */
+ public String getItemAction() {
+ return itemAction;
+ }
+
+ /**
+ * Set a new value for itemAction field.
+ *
+ * @param itemAction
+ * a new value for itemAction field
+ */
+ public void setItemAction(String itemAction) {
+ this.itemAction = itemAction;
+ }
+
+ public void actionListener(ActionEvent event) {
+ this.value = event.getComponent().getId();
+ }
+
+ public void itemActionServer() {
+ setItemAction("server");
+ }
+
+ public void itemActionAjax() {
+ setItemAction("ajax");
+ }
+
+ public void itemActionNone() {
+ setItemAction("NOT none");
+ }
+
+ public String increment() {
+ if (4 == this.value2) {
+ this.value2 = 0;
+ }
+ this.value2++;
+ return null;
+ }
+
+ public void cleanValues() {
+ value = "";
+ value2 = 0;
+ panelValue = null;
+ panelValue2 = null;
+ itemAction = "";
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-06
16:30:08 UTC (rev 10672)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-06
17:25:49 UTC (rev 10673)
@@ -7,9 +7,11 @@
public class PanelMenuTest extends SeleniumTestBase {
+ private final static String RESET_METHOD_NAME =
"#{panelBean.cleanValues}";
+
@Test
public void testPanelMenuClientAPI(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
String form1 = getParentId() + "_form1:";
String form2 = getParentId() + "_form2:";
@@ -48,13 +50,12 @@
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
-
- tearDown();
}
@Test
public void testPanelMenuComponent(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form1:";
String value1Id = getParentId() + "_value";
@@ -120,13 +121,12 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
-
- tearDown();
}
@Test
public void testPanelMenuComponentSingleMode(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form2:";
String value1Id = getParentId() + "_value";
@@ -191,55 +191,67 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
-
- tearDown();
}
@Test
- public void testPanelMenuItemAction(Template template) {
- renderPage(template);
+ public void testPanelMenuItemActionAndSubmitModeInheritance(Template template) {
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form";
+ String itemAction = getParentId() + "_itemAction";
- String value1Id = getParentId() + "_value";
- String value2Id = getParentId() + "_value2";
+ writeStatus("Test panel menu with ajax submission mode.");
+ writeStatus("Click on ajax group");
- String group = "tablehide" + parentId + "1:pGroup1";
- String groupSingle = "tablehide" + parentId +
"2:pGroup1_single";
+ clickAjaxCommandAndWait("tablehide" + parentId +
"1:pGroup1");
- String item = "tablehide" + parentId + "1:pItem1";
- String itemSingle = "tablehide" + parentId +
"2:pItem1_single";
+ writeStatus("Click on expanded server action item");
+ clickCommandAndWait("tablehide" + parentId + "1:pItem1");
+ AssertTextEquals(itemAction, "server", "Server mode action is not
triggered");
- writeStatus("Click on ajax group");
- clickById(group);
- waitForAjaxCompletion();
- AssertTextEquals(value1Id, "pGroup1");
+ writeStatus("Click on server group");
+ clickCommandAndWait("tablehide" + parentId + "1:pGroup2");
+
+ writeStatus("Click on expanded ajax action item");
+ clickAjaxCommandAndWait("tablehide" + parentId +
"1:pItem2");
+ AssertTextEquals(itemAction, "ajax", "Ajax mode action is not
triggered");
+
+ writeStatus("Click on client group");
+
+ clickById("tablehide" + parentId + "1:pGroup3");
+
+ writeStatus("Click on expanded none action item");
+ clickById("tablehide" + parentId + "1:pItem3");
+ AssertTextNotEquals(itemAction, "NOT none", "Nothing is going to
happen");
+
+ writeStatus("Test panel menu with default(server) submission mode.");
writeStatus("Click on ajax group");
- clickById(groupSingle);
- waitForAjaxCompletion();
- AssertTextEquals(value1Id, "pGroup1_single");
- writeStatus("Click on server group");
- clickCommandAndWait(item);
- AssertTextEquals(value1Id, "pItem1");
- AssertTextEquals(value2Id, "1");
+ clickAjaxCommandAndWait("tablehide" + parentId +
"2:pGroup1_single");
+ writeStatus("Click on expanded server action item");
+ clickCommandAndWait("tablehide" + parentId +
"2:pItem1_single");
+ AssertTextEquals(itemAction, "server", "Server mode action is not
triggered");
+
writeStatus("Click on server group");
- clickCommandAndWait(itemSingle);
- AssertTextEquals(value1Id, "pItem1_single");
- AssertTextEquals(value2Id, "2");
- tearDown();
+ clickCommandAndWait("tablehide" + parentId +
"2:pGroup2_single");
+
+ writeStatus("Click on expanded ajax action item");
+ clickAjaxCommandAndWait("tablehide" + parentId +
"2:pItem2_single");
+ AssertTextEquals(itemAction, "ajax", "Ajax mode action is not
triggered");
+
+ writeStatus("Click on client group");
+
+ clickById("tablehide" + parentId + "2:pGroup3_single");
+
+ writeStatus("Click on expanded none action item");
+ clickById("tablehide" + parentId + "2:pItem3_single");
+ AssertTextNotEquals(itemAction, "NOT none", "Nothing is going to
happen");
}
public String getTestUrl() {
return "pages/panelMenu/panelMenuTest.xhtml";
}
-
- private void tearDown() {
- writeStatus("Clean bean values");
- clickById(getParentId() + "_form2:clean");
- waitForAjaxCompletion();
- }
-
}