Author: andrei_exadel
Date: 2009-01-16 09:33:26 -0500 (Fri, 16 Jan 2009)
New Revision: 12310
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/testTabServerMode.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
Log:
RF-5550
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/testTabServerMode.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/testTabServerMode.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/testTabServerMode.xhtml 2009-01-16
14:33:26 UTC (rev 12310)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="_form">
+
+ <h:message id="tab1_message"
for="tab1_input"></h:message>
+ <h:message id="tab2_message"
for="tab2_input"></h:message>
+ <rich:tabPanel id="panel"
+ switchType="server"
+ selectedTab="#{panelBean.selectedTab}"
+ >
+ <rich:tab id="tab1"
+ label="Tab1">
+ <h:outputText value="Tab1"></h:outputText>
+ <h:inputText id="tab1_input" required="true"
value="#{panelBean.inputs['tab1']}" />
+ </rich:tab>
+ <rich:tab id="tab2"
+ label="Tab2">
+ <h:outputText value="Tab2"></h:outputText>
+ <h:inputText id="tab2_input" required="true"
value="#{panelBean.inputs['tab2']}" />
+ </rich:tab>
+ </rich:tabPanel>
+ <h:outputText id="inputs"
value="#{panelBean.inputs}"></h:outputText>
+ <h:commandButton id="submit"
value="Submit"></h:commandButton>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-16
13:43:25 UTC (rev 12309)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-16
14:33:26 UTC (rev 12310)
@@ -54,6 +54,8 @@
private final static String DISABLED_TAB_URL =
"pages/tabPanel/testDisabledTab.xhtml";
private final static String IMMEDIATE_TAB_URL =
"pages/tabPanel/immediateTabTest.xhtml";
+
+ private final static String SERVER_AWARE_MODE_URL =
"pages/tabPanel/testTabServerMode.xhtml";
private static Map<String, String> params = new HashMap<String,
String>();
@@ -317,6 +319,33 @@
AssertVisible(tester.getClientId("tab2", template), "Tab was not
swtiched");
}
+
+ @Test
+ public void testServerAwareMode(Template template) {
+ renderPage(SERVER_AWARE_MODE_URL, template, RESET_METHOD);
+
+ String parentId = getParentId() + FORM_ID;
+ String tab1 = parentId + "tab1";
+ String tab2 = parentId + "tab2";
+ String messageTab1 = tab1 + "_message";
+ String messageTab2 = tab2 + "_message";
+ String inputsId = parentId + "inputs";
+ String submitId = parentId + "submit";
+
+ clickCommandAndWait(submitId);
+
+ assertMessageNotEquals(messageTab1, "", "Validation was not processed
for rendered tab");
+ assertMessageEquals(messageTab2, "", "Validation was processed for
closed tab");
+
+ setValueById(tab1 + "_input", "Some text");
+ clickCommandAndWait(tab2 + "_lbl");
+ assertMessageEquals(messageTab1, "", "Validation for the first tab
should be passed");
+ assertMessageEquals(messageTab2, "", "Validation was processed for
closed tab");
+ AssertVisible(tab2, "TabPanel was not swtiched to the second tab");
+ AssertTextEquals(inputsId, "{tab1=Some text}", "Update model for the
first tab skipped but should not");
+
+
+ }
private void testListener(String parentId) {
@@ -404,6 +433,27 @@
String commandId = parentId + "controls:reset";
clickCommandAndWait(commandId);
}
+
+ private String getMessage(String id) {
+ if (isPresent(id)) {
+ return getTextById(id);
+ }
+ return "";
+ }
+
+ private void assertMessageEquals(String id, String value, String message) {
+ String m = getMessage(id);
+ if (!value.equals(m)) {
+ Assert.fail(message);
+ }
+ }
+
+ private void assertMessageNotEquals(String id, String value, String message) {
+ String m = getMessage(id);
+ if (value.equals(m)) {
+ Assert.fail(message);
+ }
+ }
@Override
public void sendAjax() {