Author: jjamrich
Date: 2011-09-23 09:23:37 -0400 (Fri, 23 Sep 2011)
New Revision: 22737
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/CollapsibleSubTableTogglerAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java
Log:
RFPL-1439: Update CollapsibleSubTable tests to use unified way to setting attributes
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-23
13:23:05 UTC (rev 22736)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-23
13:23:37 UTC (rev 22737)
@@ -1,5 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.tests.metamer.ftest.BasicAttributes;
import org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes;
@@ -10,10 +12,9 @@
import org.richfaces.tests.metamer.ftest.abstractions.DataTableAttributes;
import org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets;
import org.richfaces.tests.metamer.ftest.richAutocomplete.AutocompleteAttributes;
+import
org.richfaces.tests.metamer.ftest.richCollapsibleSubTableToggler.CollapsibleSubTableTogglerAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
-import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
-
public class AttributeList {
public static Attributes<BasicAttributes> basicAttributes = new
Attributes<BasicAttributes>();
@@ -27,5 +28,7 @@
public static Attributes<DataTableAttributes> dataTableAttributes = new
Attributes<DataTableAttributes>();
public static Attributes<DataTableFacets> dataTableFacets = new
Attributes<DataTableFacets>(RequestType.XHR); // for facets use XHR by default
public static Attributes<AutocompleteAttributes> autocompleteAttributes = new
Attributes<AutocompleteAttributes>();
+ public static Attributes<CollapsibleSubTableTogglerAttributes>
collapsibleSubTableTogglerAttributes =
+ new Attributes<CollapsibleSubTableTogglerAttributes>();
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-23
13:23:05 UTC (rev 22736)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-23
13:23:37 UTC (rev 22737)
@@ -72,6 +72,10 @@
setProperty(attribute.toString(), item.toString());
}
+ public void set(T attribute, Event event) {
+ setProperty(attribute.toString(), event.getEventName());
+ }
+
/**
* Retrieve current attribute value
* @param attribute
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/CollapsibleSubTableTogglerAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/CollapsibleSubTableTogglerAttributes.java 2011-09-23
13:23:05 UTC (rev 22736)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/CollapsibleSubTableTogglerAttributes.java 2011-09-23
13:23:37 UTC (rev 22737)
@@ -21,35 +21,19 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richCollapsibleSubTableToggler;
-import org.jboss.test.selenium.dom.Event;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class CollapsibleSubTableTogglerAttributes extends AbstractComponentAttributes {
- public void setCollapsedIcon(String collapsedIcon) {
- setProperty("collapsedIcon", collapsedIcon);
- }
-
- public void setCollapsedLabel(String collapsedLabel) {
- setProperty("collapsedLabel", collapsedLabel);
- }
-
- public void setEvent(Event event) {
- setProperty("event", event);
- }
-
- public void setExpandedIcon(String expandedIcon) {
- setProperty("expandedIcon", expandedIcon);
- }
-
- public void setExpandedLabel(String expandedLabel) {
- setProperty("expandedLabel", expandedLabel);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
+public enum CollapsibleSubTableTogglerAttributes implements AttributeEnum {
+
+ collapsedIcon,
+ collapsedLabel,
+ event,
+ expandedIcon,
+ expandedLabel,
+ rendered
+
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java 2011-09-23
13:23:05 UTC (rev 22736)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java 2011-09-23
13:23:37 UTC (rev 22737)
@@ -31,6 +31,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.collapsibleSubTableTogglerAttributes;
+import static
org.richfaces.tests.metamer.ftest.richCollapsibleSubTableToggler.CollapsibleSubTableTogglerAttributes.*;
import java.net.URL;
@@ -53,7 +55,6 @@
private static final String IMAGE_URL = "/resources/images/star.png";
private static final String LABEL = "Label";
- CollapsibleSubTableTogglerAttributes attributes = new
CollapsibleSubTableTogglerAttributes();
DataTable dataTable = new
DataTable(pjq("table.rf-dt[id$=richDataTable]"));
JQueryLocator link = jq("a");
@@ -73,7 +74,7 @@
@Test
@Use(field = "event", value = "events")
public void testEvent() {
- attributes.setEvent(Event.DBLCLICK);
+
collapsibleSubTableTogglerAttributes.set(CollapsibleSubTableTogglerAttributes.event,
Event.DBLCLICK);
TogglerTester togglerTester = new TogglerTester(image, image);
togglerTester.event = Event.DBLCLICK;
@@ -82,15 +83,15 @@
@Test
public void testRendered() {
- attributes.setRendered(false);
+ collapsibleSubTableTogglerAttributes.set(rendered, false);
assertEquals(dataTable.getTogglerCount(), 0);
}
@Test
public void testCollapsedLabel() {
- attributes.setCollapsedIcon("none");
- attributes.setCollapsedLabel(LABEL);
+ collapsibleSubTableTogglerAttributes.set(collapsedIcon, "none");
+ collapsibleSubTableTogglerAttributes.set(collapsedLabel, LABEL);
new TogglerTester(image, link) {
String expandedImageUrl;
@@ -121,7 +122,7 @@
@Test
public void testExpandedLabel() {
- attributes.setExpandedLabel(LABEL);
+ collapsibleSubTableTogglerAttributes.set(expandedLabel, LABEL);
new TogglerTester(link, image) {
@@ -149,7 +150,7 @@
@Test
public void testExpandedIcon() {
- attributes.setExpandedIcon(IMAGE_URL);
+ collapsibleSubTableTogglerAttributes.set(expandedIcon, IMAGE_URL);
new TogglerTester(image, image) {
@@ -177,7 +178,7 @@
@Test
public void testCollapsedIcon() {
- attributes.setCollapsedIcon(IMAGE_URL);
+ collapsibleSubTableTogglerAttributes.set(collapsedIcon, IMAGE_URL);
new TogglerTester(image, image) {