Author: dsvyatobatsko
Date: 2009-03-05 12:29:34 -0500 (Thu, 05 Mar 2009)
New Revision: 12846
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/layoutTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/testFacets.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/pickListAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
Log:
RF-6169, RF-6172, RF-6173, RF-6176
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/layoutTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/layoutTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/pickListAutoTest.xhtml
===================================================================
(Binary files differ)
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/testFacets.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/testFacets.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-03-05
17:28:56 UTC (rev 12845)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-03-05
17:29:34 UTC (rev 12846)
@@ -20,6 +20,7 @@
*/
package org.richfaces.testng;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -27,6 +28,7 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -45,6 +47,10 @@
private final static String I18N_TEST_URL =
"pages/pickList/testI18N.xhtml";
+ private final static String LAYOUT_TEST_URL =
"pages/pickList/layoutTest.xhtml";
+
+ private final static String FACETS_TEST_URL =
"pages/pickList/testFacets.xhtml";
+
private static Map<String, String> params = new HashMap<String,
String>();
static {
@@ -226,6 +232,104 @@
AssertTextEquals(removeAllElemId, "l�schen alles");
}
+ @Test
+ public void testStandardHTMLAttributesAreOutputToClient(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(LAYOUT_TEST_URL, template, RESET_METHOD);
+
+ String pickList = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ writeStatus("Check component's specific HTML attributes are output to
client");
+
+ List<String> eventsExpected = new ArrayList<String>();
+ eventsExpected.add("onlistchange");
+ eventsExpected.add("onlistchanged");
+ eventsExpected.add("onclick");
+
+ changeValue();
+ assertEvents(eventsExpected);
+
+ writeStatus("Check standart HTML attributes");
+ assertEvents(pickList, SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
+ @Test
+ public void testStylesAndStyleClassesAreOutputToClient(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(LAYOUT_TEST_URL, template, RESET_METHOD);
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ String pickListId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ assertStyleAttributeContains(pickListId, "font-size: 13px", "Style
attribute was not output to client");
+ assertClassAttributeContains(pickListId, "noclass", "Class
attribute was not output to client");
+
+ writeStatus("Check listClass attributes");
+ String srcListXpath = "//*[@id='" + pickListId +
"']/tbody/tr/td[1]/div";
+ assertClassAttributeContains(srcListXpath, "list-class",
"listClass attribute was not output to client for source (left) list)");
+ String destListXpath = "//*[@id='" + pickListId +
"']/tbody/tr/td[3]/div";
+ assertClassAttributeContains(destListXpath, "list-class",
"listClass attribute was not output to client for destination (right) list)");
+
+ writeStatus("Check controlClass attributes");
+ String controlsXpath = "//*[@id='" + pickListId +
"']/tbody/tr/td[2]/div";
+ assertClassAttributeContains(controlsXpath, "control-class",
"controlClass attribute was not output to client");
+
+ // declared disabledStyle, disabledStyleClass, enabledStyle,
+ // enabledStyleClass attributes are not output
+ }
+
+ @Test
+ public void testShowButtonsLabelAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(LAYOUT_TEST_URL, template, RESET_METHOD);
+
+ writeStatus("Check 'showButtonsLabel' attribute");
+
+ String pickListId = tester.getClientId(AutoTester.COMPONENT_ID);
+
+ String copyElemId = pickListId + COPY_BTN;
+ String copyAllElemId = pickListId + COPY_ALL_BTN;
+ String removeElemId = pickListId + REMOVE_BTN;
+ String removeAllElemId = pickListId + REMOVE_ALL_BTN;
+
+ writeStatus("Check labels are gone");
+
+ AssertTextEquals(copyElemId, "");
+ AssertTextEquals(copyAllElemId, "");
+ AssertTextEquals(removeElemId, "");
+ AssertTextEquals(removeAllElemId, "");
+ }
+
+ @Test
+ public void testFacets(Template template) {
+ renderPage(FACETS_TEST_URL, template, RESET_METHOD);
+
+ writeStatus("Check facets");
+
+ assertFacetEnabled("copyAllControl", true);
+ assertFacetEnabled("copyControl", false);
+ assertFacetEnabled("removeControl", false);
+ assertFacetEnabled("removeAllControl", true);
+
+ writeStatus("Copy all");
+ clickById("_copyAllControl");
+
+ assertFacetEnabled("copyAllControl", false);
+ assertFacetEnabled("copyControl", false);
+ assertFacetEnabled("removeControl", false);
+ assertFacetEnabled("removeAllControl", true);
+
+ writeStatus("Remove all");
+ clickById("_removeAllControl");
+
+ assertFacetEnabled("copyAllControl", true);
+ assertFacetEnabled("copyControl", false);
+ assertFacetEnabled("removeControl", false);
+ assertFacetEnabled("removeAllControl", false);
+
+ // AssertPresentAndVisible("_caption", "Caption facet is not
rendered");
+ }
+
private void assertButtonEnabled(String btnId) {
String id = getParentId() + "_form:" + PICK_LIST;
AssertVisible(id + btnId);
@@ -238,6 +342,21 @@
AssertVisible(id + "dis" + btnId);
}
+ private void assertFacetEnabled(String name, boolean enabled) {
+ String patternXpath = "//*[@id='" + getParentId() +
"_form:componentId']/tbody/tr/td[2]/div//div[@id='%1$s']";
+
+ String eFacet = name;
+ String dFacet = name + "Disabled";
+
+ if(enabled) {
+ Assert.assertTrue(isVisible(String.format(patternXpath, "_" +
eFacet)), eFacet + " facet is not rendered in control panel!");
+ Assert.assertFalse(isVisible(String.format(patternXpath, "_" +
dFacet)), dFacet + " facet has not to be rendered in control panel at this
moment!");
+ } else {
+ Assert.assertTrue(isVisible(String.format(patternXpath, "_" +
dFacet)), dFacet + " facet is not rendered in control panel!");
+ Assert.assertFalse(isVisible(String.format(patternXpath, "_" +
eFacet)), eFacet + " facet has not to be rendered in control panel at this
moment!");
+ }
+ }
+
/**
* Returns number of children for DOM element with given id.
* @param elemId DOM element id