JBoss Rich Faces SVN: r21025 - in modules/tests/metamer/trunk: application/src/main/resources/org/richfaces/tests/metamer/bean and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-14 09:45:07 -0500 (Fri, 14 Jan 2011)
New Revision: 21025
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuGroupBean.properties
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuGroupBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuGroup/simple.xhtml
Log:
https://issues.jboss.org/browse/RFPL-959
* added 23 tests for rich:menuGroup
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuGroupBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuGroupBean.java 2011-01-14 14:44:02 UTC (rev 21024)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuGroupBean.java 2011-01-14 14:45:07 UTC (rev 21025)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -54,6 +54,7 @@
attributes = Attributes.getComponentAttributesFromFacesConfig(UIMenuGroup.class, getClass());
+ attributes.setAttribute("label", "Save As...");
attributes.setAttribute("rendered", true);
attributes.remove("converter");
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuGroupBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuGroupBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuGroupBean.properties 2011-01-14 14:45:07 UTC (rev 21025)
@@ -0,0 +1,37 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
+
+attr.direction.topLeft=topLeft
+attr.direction.topRight=topRight
+attr.direction.bottomLeft=bottomLeft
+attr.direction.bottomRight=bottomRight
+attr.direction.autoLeft=autoLeft
+attr.direction.autoRight=autoRight
+attr.direction.topAuto=topAuto
+attr.direction.bottomAuto=bottomAuto
+attr.direction.auto=auto
+attr.direction.null=
+
+attr.icon.createdoc=/resources/images/icons/create_doc.gif
+attr.icon.star=/resources/images/star.png
+attr.icon.heart=/resources/images/heart.png
+attr.icon.nonexisting=nonexisting
+attr.icon.null=
+
+attr.iconDisabled.createdoc=/resources/images/icons/create_doc.gif
+attr.iconDisabled.star=/resources/images/star.png
+attr.iconDisabled.heart=/resources/images/heart.png
+attr.iconDisabled.nonexisting=nonexisting
+attr.iconDisabled.null=
+
+attr.jointPoint.topLeft=topLeft
+attr.jointPoint.topRight=topRight
+attr.jointPoint.bottomLeft=bottomLeft
+attr.jointPoint.bottomRight=bottomRight
+attr.jointPoint.autoLeft=autoLeft
+attr.jointPoint.autoRight=autoRight
+attr.jointPoint.topAuto=topAuto
+attr.jointPoint.bottomAuto=bottomAuto
+attr.jointPoint.auto=auto
+attr.jointPoint.null=
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuGroup/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuGroup/simple.xhtml 2011-01-14 14:44:02 UTC (rev 21024)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuGroup/simple.xhtml 2011-01-14 14:45:07 UTC (rev 21025)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -53,7 +53,7 @@
</ui:define>
<ui:define name="component">
- <rich:toolbar id="toolbar" height="26px">
+ <rich:toolbar id="toolbar" height="26px" width="500px;">
<rich:dropDownMenu id="menu1" menu="ajax">
<f:facet name="label">
<h:panelGroup>
@@ -62,13 +62,13 @@
</h:panelGroup>
</f:facet>
- <rich:menuItem label="New" icon="/resources/images/icons/create_doc.gif"/>
+ <rich:menuItem id="menuItem1" label="New" icon="/resources/images/icons/create_doc.gif"/>
- <rich:menuItem label="Open" icon="/resources/images/icons/open.gif" />
+ <rich:menuItem id="menuItem2" label="Open" icon="/resources/images/icons/open.gif" />
- <rich:menuGroup label="Open Recent..." disabled="true">
- <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All">
+ <rich:menuGroup id="menuGroup3" label="Open Recent..." disabled="true">
+ <rich:menuItem id="menuItem31" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save All">
<f:facet name="icon">
<h:graphicImage library="images/icons" name="save_all.gif" />
</f:facet>
@@ -77,12 +77,16 @@
<rich:menuSeparator id="menuSeparator11" />
- <rich:menuGroup id="menuGroup"
+ <rich:menuGroup id="menuGroup4"
dir="#{richMenuGroupBean.attributes['dir'].value}"
+ direction="#{richMenuGroupBean.attributes['direction'].value}"
disabled="#{richMenuGroupBean.attributes['disabled'].value}"
- label="Save As..."
+ horizontalOffset="#{richMenuGroupBean.attributes['horizontalOffset'].value}"
+ icon="#{richMenuGroupBean.attributes['icon'].value}"
+ iconDisabled="#{richMenuGroupBean.attributes['iconDisabled'].value}"
+ jointPoint="#{richMenuGroupBean.attributes['jointPoint'].value}"
+ label="#{richMenuGroupBean.attributes['label'].value}"
lang="#{richMenuGroupBean.attributes['lang'].value}"
- mode="#{richMenuGroupBean.attributes['mode'].value}"
onclick="#{richMenuGroupBean.attributes['onclick'].value}"
ondblclick="#{richMenuGroupBean.attributes['ondblclick'].value}"
onhide="#{richMenuGroupBean.attributes['onhide'].value}"
@@ -100,23 +104,24 @@
styleClass="#{richMenuGroupBean.attributes['styleClass'].value}"
title="#{richMenuGroupBean.attributes['title'].value}"
value="#{richMenuGroupBean.attributes['value'].value}"
+ verticalOffset="#{richMenuGroupBean.attributes['verticalOffset'].value}"
>
- <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All" >
+ <rich:menuItem id="menuItem41" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save All" >
<f:facet name="icon">
<h:graphicImage library="images/icons" name="save_all.gif" />
</f:facet>
</rich:menuItem>
- <rich:menuItem label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ <rich:menuItem id="menuItem43" label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
</rich:menuGroup>
- <rich:menuItem label="Print" disabled="true"/>
+ <rich:menuItem id="menuItem5" label="Print" disabled="true"/>
- <rich:menuItem label="Close" />
+ <rich:menuItem id="menuItem6" label="Close" />
<rich:menuSeparator id="menuSeparator12" />
- <rich:menuItem label="Exit" />
+ <rich:menuItem id="menuItem7" label="Exit" />
</rich:dropDownMenu>
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java 2011-01-14 14:45:07 UTC (rev 21025)
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richMenuGroup;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.EventFiredCondition;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richMenuGroup/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichMenuGroup extends AbstractMetamerTest {
+
+ private JQueryLocator fileMenu = pjq("div[id$=menu1]");
+ private JQueryLocator fileMenuList = pjq("div[id$=menu1_list]");
+ private JQueryLocator group = pjq("div[id$=menuGroup4]");
+ private JQueryLocator groupList = pjq("div[id$=menuGroup4_list]");
+ private JQueryLocator icon = group.getDescendant(jq("> span.rf-ddm-itm-ic img"));
+ private JQueryLocator emptyIcon = group.getDescendant(jq("> span.rf-ddm-itm-ic > div.rf-ddm-emptyIcon"));
+ private JQueryLocator label = group.getDescendant(jq("span.rf-ddm-itm-lbl"));
+ private JQueryLocator menuItem41 = pjq("div[id$=menuItem41]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richMenuGroup/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(fileMenu), "Drop down menu \"File\" should be present on the page.");
+ assertTrue(selenium.isVisible(fileMenu), "Drop down menu \"File\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(group), "Menu group \"Save As...\" should be present on the page.");
+ assertFalse(selenium.isVisible(group), "Menu group \"Save As...\" should not be visible on the page.");
+
+ assertFalse(selenium.isDisplayed(fileMenuList), "Menu should not be expanded.");
+ guardNoRequest(selenium).click(fileMenu);
+ assertTrue(selenium.isDisplayed(fileMenuList), "Menu should be expanded.");
+
+ assertTrue(selenium.isElementPresent(group), "Menu group \"Save As...\" should be present on the page.");
+ assertTrue(selenium.isVisible(group), "Menu group \"Save As...\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuItem41), "Menu item \"Save\" should be present on the page.");
+ assertFalse(selenium.isVisible(menuItem41), "Menu item \"Save\" should not be visible on the page.");
+
+ assertFalse(selenium.isDisplayed(groupList), "Submenu should not be expanded.");
+ guardNoRequest(selenium).mouseOver(group);
+ assertTrue(selenium.isDisplayed(groupList), "Submenu should be expanded.");
+
+ assertTrue(selenium.isElementPresent(menuItem41), "Menu item \"Save\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuItem41), "Menu item \"Save\" should be visible on the page.");
+
+ assertFalse(selenium.isElementPresent(icon), "Icon of menu group should not be present on the page.");
+ assertTrue(selenium.isElementPresent(emptyIcon), "Menu group should have an empty icon.");
+
+ assertTrue(selenium.isElementPresent(label), "Label of menu group should be present on the page.");
+ assertTrue(selenium.isVisible(label), "Label of menu group should be visible on the page.");
+
+ assertEquals(selenium.getText(label), "Save As...", "Label of menu group.");
+ }
+
+ @Test
+ public void testDir() {
+ testDir(group);
+ }
+
+// @Test
+// @IssueTracking("https://issues.jboss.org/browse/RF-10218")
+// public void testDirection() {
+// fail("not implemented in RichFaces");
+// }
+ @Test
+ public void testDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.belongsClass(group, "rf-ddm-itm-dis"), "Menu group should have class \"rf-ddm-itm-dis\".");
+ assertTrue(selenium.isElementPresent(emptyIcon), "Empty icon should be present.");
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present.");
+ }
+
+// @Test
+// @IssueTracking("https://issues.jboss.org/browse/RF-10216")
+// public void testHorizontalOffset() {
+// fail("not implemented in RichFaces");
+// }
+ @Test
+ public void testIcon() {
+ AttributeLocator attr = icon.getAttribute(Attribute.SRC);
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"), "Icon's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Icon's src attribute should contain \"nonexisting\".");
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("null"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present.");
+ assertTrue(selenium.isElementPresent(emptyIcon), "Empty icon should be present.");
+ }
+
+ @Test
+ public void testIconDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ AttributeLocator attr = icon.getAttribute(Attribute.SRC);
+
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present.");
+ assertTrue(selenium.isElementPresent(emptyIcon), "Empty icon should be present.");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"), "Icon's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Icon's src attribute should contain \"nonexisting\".");
+ }
+
+// @Test
+// @IssueTracking("https://issues.jboss.org/browse/RF-10218")
+// public void testJointPoint() {
+// fail("not implemented in RichFaces");
+// }
+ @Test
+ public void testLabel() {
+ selenium.type(pjq("input[type=text][id$=labelInput]"), "new label");
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(label), "new label", "New label of the menu group.");
+ }
+
+ @Test
+ public void testLang() {
+ testLang(group);
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, group);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, group);
+ }
+
+ @Test
+ public void testOnhide() {
+ selenium.type(pjq("input[id$=onhideInput]"), "metamerEvents += \"hide \"");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(fileMenu);
+ waitGui.failWith("Menu was not open.").until(isDisplayed.locator(fileMenuList));
+ selenium.mouseOver(group);
+ waitGui.failWith("Submenu was not open").until(isDisplayed.locator(groupList));
+ selenium.mouseOut(group);
+
+ waitGui.failWith("Attribute onhide does not work correctly").until(new EventFiredCondition(new Event("hide")));
+ }
+
+ @Test
+ public void testOnkeydown() {
+ testFireEvent(Event.KEYDOWN, group);
+ }
+
+ @Test
+ public void testOnkeypress() {
+ testFireEvent(Event.KEYPRESS, group);
+ }
+
+ @Test
+ public void testOnkeyup() {
+ testFireEvent(Event.KEYUP, group);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, group);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, group);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, group);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, group);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, group);
+ }
+
+ @Test
+ public void testOnshow() {
+ selenium.type(pjq("input[id$=onshowInput]"), "metamerEvents += \"show \"");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(fileMenu);
+ waitGui.failWith("Menu was not open.").until(isDisplayed.locator(fileMenuList));
+ selenium.mouseOver(group);
+ waitGui.failWith("Submenu was not open").until(isDisplayed.locator(groupList));
+
+ waitGui.failWith("Attribute onhide does not work correctly").until(new EventFiredCondition(new Event("show")));
+ }
+
+ @Test
+ public void testRendered() {
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(group), "Menu group should not be rendered when rendered=false.");
+ assertTrue(selenium.isDisplayed(group), "Menu group should be displayed when item 1 is not rendered.");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(group, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(group, "styleClass");
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(group);
+ }
+// @Test
+// @IssueTracking("https://issues.jboss.org/browse/RF-10216")
+// public void testVerticalOffset() {
+// fail("not implemented in RichFaces");
+// }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 11 months
JBoss Rich Faces SVN: r21024 - trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dataScroller/samples.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2011-01-14 09:44:02 -0500 (Fri, 14 Jan 2011)
New Revision: 21024
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dataScroller/samples/dataScrollerAPI-sample.xhtml
Log:
https://issues.jboss.org/browse/RF-10193
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dataScroller/samples/dataScrollerAPI-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dataScroller/samples/dataScrollerAPI-sample.xhtml 2011-01-14 13:52:42 UTC (rev 21023)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/dataScroller/samples/dataScrollerAPI-sample.xhtml 2011-01-14 14:44:02 UTC (rev 21024)
@@ -23,7 +23,7 @@
onclick="#{rich:component('ds')}.next()" />
</h:panelGrid>
<rich:dataScroller for="pics" id="ds" render="repeat"
- stepControls="none" boundaryControls="none" fastControls="none"
+ stepControls="hide" boundaryControls="hide" fastControls="hide"
maxPages="10" />
</h:panelGrid>
</h:form>
13 years, 11 months
JBoss Rich Faces SVN: r21023 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: model and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-14 08:52:42 -0500 (Fri, 14 Jan 2011)
New Revision: 21023
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTableToggler.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java
Log:
rich:collapsibleSubTable - automated Simple sample (RFPL-731)
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTable.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -0,0 +1,43 @@
+package org.richfaces.tests.metamer.ftest.model;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+public class CollapsibleSubTable extends AbstractModel<JQueryLocator> {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ JQueryLocator subtableRow = jq("tr[class^=rf-cst][class$=-r]");
+ JQueryLocator subtableCell = jq("td.rf-cst-c");
+
+ JQueryLocator visible = jq("{0}:visible");
+
+ public CollapsibleSubTable(JQueryLocator root) {
+ super(root);
+ }
+
+ public Iterable<JQueryLocator> getRows() {
+ return root.getLocator().getChildren(subtableRow);
+ }
+
+ public JQueryLocator getRow(int rowIndex) {
+ return root.getLocator().getChild(subtableRow).getNthOccurence(rowIndex);
+ }
+
+ public int getRowCount() {
+ return selenium.getCount(root.getLocator().getChild(subtableRow));
+ }
+
+ public boolean hasVisibleRows() {
+ JQueryLocator locator = root.getLocator().getChild(subtableRow);
+ locator = visible.format(locator.getRawLocator());
+ return selenium.isElementPresent(locator);
+ }
+
+ public JQueryLocator getCell(int column, int row) {
+ return getRow(row).getChild(subtableCell).getNthOccurence(column);
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTableToggler.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTableToggler.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/CollapsibleSubTableToggler.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -0,0 +1,26 @@
+package org.richfaces.tests.metamer.ftest.model;
+
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+
+public class CollapsibleSubTableToggler extends AbstractModel<JQueryLocator> {
+
+ public CollapsibleSubTableToggler(JQueryLocator root) {
+ super(root);
+ }
+
+ ReferencedLocator<JQueryLocator> collapsedTogglers = ref(root, "> span[id$=expand]");
+ ReferencedLocator<JQueryLocator> expandedTogglers = ref(root, "> span[id$=collapse]");
+
+ public ExtendedLocator<JQueryLocator> getCollapsed() {
+ return collapsedTogglers;
+ }
+
+ public ExtendedLocator<JQueryLocator> getExpanded() {
+ return expandedTogglers;
+ }
+
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java 2011-01-14 13:51:17 UTC (rev 21022)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -50,7 +50,11 @@
ReferencedLocator<JQueryLocator> columnHeader = ref(thead, "> tr.rf-dt-shdr > th.rf-dt-shdr-c");
ReferencedLocator<JQueryLocator> columnFooter = ref(root, "> tfoot.rf-dt-tft > tr.rf-dt-sftr > td.rf-dt-sftr-c");
+
+ ReferencedLocator<JQueryLocator> subtables = ref(root, "> tbody.rf-cst");
+ ReferencedLocator<JQueryLocator> togglers = ref(root, "span[id$=subTableTC]");
+
public DataTable(JQueryLocator root) {
super(root);
}
@@ -103,5 +107,24 @@
public JQueryLocator getHeader() {
return tableHeader.getReferenced();
}
+
+ public CollapsibleSubTable getSubtable(int index) {
+ return new CollapsibleSubTable(subtables.getNthOccurence(index));
+ }
+ public Iterable<CollapsibleSubTable> getSubtables() {
+ return new ModelIterable<JQueryLocator, CollapsibleSubTable>(subtables.getAllOccurrences(), CollapsibleSubTable.class);
+ }
+
+ public int getSubtableCount() {
+ return selenium.getCount(subtables);
+ }
+
+ public int getTogglerCount() {
+ return selenium.getCount(togglers);
+ }
+
+ public CollapsibleSubTableToggler getToggler(int index) {
+ return new CollapsibleSubTableToggler(togglers.getNthOccurence(index));
+ }
}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -0,0 +1,78 @@
+package org.richfaces.tests.metamer.ftest.richCollapsibleSubTable;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTable;
+import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTableToggler;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.richfaces.tests.metamer.model.Employee;
+import org.testng.annotations.BeforeMethod;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+
+public abstract class AbstractCollapsibleSubTableTest extends AbstractMetamerTest {
+
+ private static final List<Employee> EMPLOYEES = Model.unmarshallEmployees();
+
+ CollapsibleSubTableAttributes attributes = new CollapsibleSubTableAttributes();
+ DataTable model = new DataTable(pjq("table.rf-dt"));;
+
+ @Inject
+ @Use(value = "configuration*")
+ Configuration configuration;
+ Configuration configurationMen = new Configuration(1, "Men");
+ Configuration configurationWomen = new Configuration(2, "Women");
+
+ CollapsibleSubTable subtable;
+ CollapsibleSubTableToggler toggler;
+ List<Employee> employees;
+
+ Configuration secondConfiguration;
+ CollapsibleSubTable secondSubtable;
+ CollapsibleSubTableToggler secondToggler;
+
+ @BeforeMethod
+ public void configure() {
+ if (configuration != null) {
+ subtable = configuration.subtable;
+ toggler = configuration.toggler;
+ employees = configuration.employees;
+
+ secondConfiguration = configuration.name.equals("Men") ? configurationWomen : configurationMen;
+ secondSubtable = secondConfiguration.subtable;
+ secondToggler = secondConfiguration.toggler;
+ }
+ }
+
+ public class Configuration {
+ CollapsibleSubTable subtable;
+ CollapsibleSubTableToggler toggler;
+ List<Employee> employees;
+ String name;
+
+ public Configuration(int i, String name) {
+ this.name = name;
+ subtable = model.getSubtable(i);
+ toggler = model.getToggler(i);
+ final Employee.Sex sex = (i == 1) ? Employee.Sex.MALE : Employee.Sex.FEMALE;
+
+ employees = new LinkedList<Employee>(Collections2.filter(EMPLOYEES, new Predicate<Employee>() {
+ @Override
+ public boolean apply(Employee input) {
+ return sex.equals(input.getSex());
+ }
+ }));
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -0,0 +1,41 @@
+package org.richfaces.tests.metamer.ftest.richCollapsibleSubTable;
+
+import java.util.Collection;
+
+import org.richfaces.ExpandMode;
+import org.richfaces.model.SortMode;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+public class CollapsibleSubTableAttributes extends AbstractComponentAttributes {
+ public void setExpandMode(ExpandMode expandMode) {
+ setProperty("expandMode", expandMode);
+ }
+
+ public void setExpanded(Boolean expanded) {
+ setProperty("expanded", expanded);
+ }
+
+ public void setFirst(Integer first) {
+ setProperty("first", first);
+ }
+
+ public void setNoDataLabel(String noDataLabel) {
+ setProperty("noDataLabel", noDataLabel);
+ }
+
+ public void setRendered(Boolean rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setRows(Integer rows) {
+ setProperty("rows", rows);
+ }
+
+ public void setSortMode(SortMode sortMode) {
+ setProperty("sortMode", sortMode);
+ }
+
+ public void setSortPriority(Collection<String> sortPriority) {
+ setProperty("sortPriority", sortPriority);
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -0,0 +1,147 @@
+package org.richfaces.tests.metamer.ftest.richCollapsibleSubTable;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guard;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.test.selenium.request.RequestType;
+import org.richfaces.ExpandMode;
+import org.richfaces.component.UICollapsibleSubTable;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.model.Employee;
+import org.testng.annotations.Test;
+
+public class TestCollapsibleSubTableSimple extends AbstractCollapsibleSubTableTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richCollapsibleSubTable/simple.xhtml");
+ }
+
+ @Inject
+ @Use(empty = true)
+ ExpandMode expandMode;
+
+ @Test
+ @Use(field = "expandMode", enumeration = true)
+ @IssueTracking("https://issues.jboss.org/browse/RF-10181")
+ public void testExpandMode() {
+ final RequestType requestType = getRequestTypeForExpandMode();
+
+ attributes.setExpandMode(expandMode);
+
+ assertTrue(subtable.hasVisibleRows());
+ assertTrue(secondSubtable.hasVisibleRows());
+
+ if (expandMode == ExpandMode.none) {
+ guard(selenium, requestType).click(toggler);
+ assertEquals(subtable.hasVisibleRows(), ExpandMode.none == expandMode);
+ assertTrue(secondSubtable.hasVisibleRows());
+ } else {
+ for (int i = 0; i < 2; i++) {
+ guard(selenium, requestType).click(toggler);
+ assertFalse(subtable.hasVisibleRows());
+ assertTrue(secondSubtable.hasVisibleRows());
+
+ guard(selenium, requestType).click(toggler);
+ assertTrue(subtable.hasVisibleRows());
+ assertTrue(secondSubtable.hasVisibleRows());
+ }
+ }
+ }
+
+ @Test
+ @Use(field = "configuration", empty = true)
+ public void testExpanded() {
+ attributes.setExpanded(false);
+
+ assertFalse(configurationMen.subtable.hasVisibleRows());
+ assertFalse(configurationWomen.subtable.hasVisibleRows());
+
+ selenium.click(configurationMen.toggler);
+ assertTrue(configurationMen.subtable.hasVisibleRows());
+
+ attributes.setExpanded(true);
+
+ assertTrue(configurationMen.subtable.hasVisibleRows());
+ assertTrue(configurationWomen.subtable.hasVisibleRows());
+
+ new UICollapsibleSubTable().getCaptionClass();
+ }
+
+ @Test
+ public void testFirst() {
+ attributes.setFirst(2);
+
+ List<Employee> visibleEmployees = employees.subList(2, subtable.getRowCount());
+
+ for (int i = 0; i < visibleEmployees.size(); i++) {
+ String name = selenium.getText(subtable.getCell(1, i + 1));
+ String title = selenium.getText(subtable.getCell(2, i + 1));
+
+ assertEquals(name, visibleEmployees.get(i).getName());
+ assertEquals(title, visibleEmployees.get(i).getTitle());
+ }
+ }
+
+ @Test
+ @Use(field = "configuration", empty = true)
+ public void testRendered() {
+ attributes.setRendered(false);
+
+ assertFalse(configurationMen.subtable.hasVisibleRows());
+ assertFalse(configurationWomen.subtable.hasVisibleRows());
+
+ selenium.click(configurationMen.toggler);
+ assertFalse(configurationMen.subtable.hasVisibleRows());
+
+ attributes.setRendered(true);
+
+ assertTrue(configurationMen.subtable.hasVisibleRows());
+ assertTrue(configurationWomen.subtable.hasVisibleRows());
+ }
+
+ @Test
+ public void testRows() {
+ attributes.setRows(11);
+
+ List<Employee> visibleEmployees = employees.subList(0, 11);
+
+ assertEquals(subtable.getRowCount(), 11);
+
+ for (int i = 0; i < visibleEmployees.size(); i++) {
+ String name = selenium.getText(subtable.getCell(1, i + 1));
+ String title = selenium.getText(subtable.getCell(2, i + 1));
+
+ assertEquals(name, visibleEmployees.get(i).getName());
+ assertEquals(title, visibleEmployees.get(i).getTitle());
+ }
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10217")
+ @Use(field = "configuration", empty = true)
+ public void testClasses() {
+ // TODO classes are currently not working
+ fail();
+ }
+
+ private RequestType getRequestTypeForExpandMode() {
+ switch (expandMode) {
+ case ajax:
+ return RequestType.XHR;
+ case server:
+ return RequestType.HTTP;
+ default:
+ return RequestType.NONE;
+ }
+ }
+}
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-01-14 13:51:17 UTC (rev 21022)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTableToggler/TestCollapsibleSubTableToggler.java 2011-01-14 13:52:42 UTC (rev 21023)
@@ -25,8 +25,10 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
+import static org.jboss.test.selenium.dom.Event.DBLCLICK;
+import static org.jboss.test.selenium.dom.Event.MOUSEDOWN;
+import static org.jboss.test.selenium.dom.Event.MOUSEUP;
import static org.jboss.test.selenium.locator.Attribute.SRC;
-import static org.jboss.test.selenium.dom.Event.*;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
@@ -41,6 +43,9 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTable;
+import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTableToggler;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
import org.testng.annotations.Test;
public class TestCollapsibleSubTableToggler extends AbstractMetamerTest {
@@ -48,27 +53,23 @@
private final static String IMAGE_URL = "/resources/images/star.png";
private final static String LABEL = "Label";
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richCollapsibleSubTableToggler/simple.xhtml");
- }
-
- CollapsibleSubTableTogglerAttributes attributes = new CollapsibleSubTableTogglerAttributes();
-
- JQueryLocator togglers = pjq("span[id$=richSTTControl]");
- JQueryLocator collapsedTogglers = togglers.getChild(jq("span[id$=expand]"));
- JQueryLocator expandedTogglers = togglers.getChild(jq("span[id$=collapse]"));
JQueryLocator link = jq("a");
JQueryLocator image = jq("img");
- JQueryLocator subtables = pjq("table.rf-dt > tbody.rf-cst");
-
@Inject
@Use(empty = true)
Event event;
Event[] events = new Event[] { DBLCLICK, MOUSEDOWN, MOUSEUP };
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richCollapsibleSubTableToggler/simple.xhtml");
+ }
+
+ CollapsibleSubTableTogglerAttributes attributes = new CollapsibleSubTableTogglerAttributes();
+ DataTable dataTable = new DataTable(pjq("table.rf-dt"));
+
@Test
@Use(field = "event", value = "events")
public void testEvent() {
@@ -83,7 +84,7 @@
public void testRendered() {
attributes.setRendered(false);
- assertFalse(selenium.isElementPresent(togglers));
+ assertEquals(dataTable.getTogglerCount(), 0);
}
@Test
@@ -212,9 +213,9 @@
JQueryLocator expander;
JQueryLocator collapser;
- JQueryLocator togglerRoot;
+ CollapsibleSubTableToggler togglerRoot;
- JQueryLocator subtable;
+ CollapsibleSubTable subtable;
JQueryLocator togglerExpanded;
JQueryLocator togglerCollapsed;
@@ -225,10 +226,10 @@
public void testToggler() {
for (int i = 1; i <= 2; i++) {
- subtable = subtables.getNthOccurence(i);
- togglerRoot = togglers.getNthOccurence(i);
- togglerExpanded = expandedTogglers.getNthOccurence(i).getChild(expander);
- togglerCollapsed = collapsedTogglers.getNthOccurence(i).getChild(collapser);
+ subtable = dataTable.getSubtable(i);
+ togglerRoot = dataTable.getToggler(i);
+ togglerExpanded = dataTable.getToggler(i).getExpanded().getChild(expander);
+ togglerCollapsed = dataTable.getToggler(i).getCollapsed().getChild(collapser);
verifyBefore();
13 years, 11 months
JBoss Rich Faces SVN: r21022 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-14 08:51:17 -0500 (Fri, 14 Jan 2011)
New Revision: 21022
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/ModelIterable.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
Log:
AbstractModel now extends ExtendedLocator + added ModelIterable to iterate though models by giving them root locators
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java 2011-01-14 13:50:19 UTC (rev 21021)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java 2011-01-14 13:51:17 UTC (rev 21022)
@@ -21,6 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.model;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocationStrategy;
import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.reference.LocatorReference;
@@ -33,7 +36,7 @@
* @param <T>
* the iterable locator type of root
*/
-public abstract class AbstractModel<T extends ExtendedLocator<T>> {
+public abstract class AbstractModel<T extends ExtendedLocator<T>> implements ExtendedLocator<T> {
protected LocatorReference<T> root = new LocatorReference<T>(null);
private String name = this.getClass().getSimpleName();
@@ -59,4 +62,74 @@
public String toString() {
return name;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public T getChild(T elementLocator) {
+ return root.getLocator().getChild(elementLocator);
+ }
+
+ @Override
+ public T getDescendant(T elementLocator) {
+ return root.getLocator().getDescendant(elementLocator);
+ }
+
+ @Override
+ public T getNthChildElement(int index) {
+ return root.getLocator().getNthChildElement(index);
+ }
+
+ @Override
+ public T getNthOccurence(int index) {
+ return root.getLocator().getNthOccurence(index);
+ }
+
+ @Override
+ public Iterable<T> getAllChildren() {
+ return root.getLocator().getAllChildren();
+ }
+
+ @Override
+ public Iterable<T> getAllOccurrences() {
+ return root.getLocator().getAllOccurrences();
+ }
+
+ @Override
+ public Iterable<T> getChildren(T elementLocator) {
+ return root.getLocator().getChildren(elementLocator);
+ }
+
+ @Override
+ public Iterable<T> getDescendants(T elementLocator) {
+ return root.getLocator().getDescendants(elementLocator);
+ }
+
+ @Override
+ public AttributeLocator<T> getAttribute(Attribute attribute) {
+ return root.getLocator().getAttribute(attribute);
+ }
+
+ @Override
+ public ElementLocationStrategy getLocationStrategy() {
+ return root.getLocator().getLocationStrategy();
+ }
+
+ @Override
+ public String getAsString() {
+ return root.getLocator().getAsString();
+ }
+
+ @Override
+ public String getRawLocator() {
+ return root.getLocator().getRawLocator();
+ }
+
+ @Override
+ public T format(Object... args) {
+ return root.getLocator().format(args);
+ }
+
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2011-01-14 13:50:19 UTC (rev 21021)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2011-01-14 13:51:17 UTC (rev 21022)
@@ -24,12 +24,12 @@
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.jboss.test.selenium.utils.text.SimplifiedFormat;
/**
* Provides DataScroller control methods.
@@ -96,7 +96,7 @@
public void gotoPage(int pageNumber) {
if (lastPage != null && (pageNumber < 1 || pageNumber > lastPage)) {
- throw new IllegalStateException(format("The given pageNumber '{0}' is out of range of pages <1,{1}>", pageNumber, lastPage));
+ throw new IllegalStateException(SimplifiedFormat.format("The given pageNumber '{0}' is out of range of pages <1,{1}>", pageNumber, lastPage));
}
while (pageNumber > getLastVisiblePage()) {
fastForward(pageNumber);
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/ModelIterable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/ModelIterable.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/ModelIterable.java 2011-01-14 13:51:17 UTC (rev 21022)
@@ -0,0 +1,52 @@
+package org.richfaces.tests.metamer.ftest.model;
+
+import java.lang.reflect.Constructor;
+import java.util.Iterator;
+
+import org.jboss.test.selenium.locator.ExtendedLocator;
+
+public class ModelIterable<E extends ExtendedLocator<E>, T extends AbstractModel<E>> implements Iterable<T> {
+
+ Iterable<E> iterable;
+ Class<T> classT;
+
+ public ModelIterable(Iterable<E> iterable, Class<T> classT) {
+ this.iterable = iterable;
+ this.classT = classT;
+ }
+
+ @Override
+ public Iterator<T> iterator() {
+ return new ModelIterator();
+ }
+
+ public class ModelIterator implements Iterator<T> {
+
+ Iterator<E> iterator = iterable.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public T next() {
+ ExtendedLocator<E> locator = iterator.next();
+
+ try {
+ Constructor<T> constructor = classT.getConstructor(ExtendedLocator.class);
+ T newInstance = constructor.newInstance(locator);
+ return newInstance;
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("unsupported operation");
+ }
+ }
+
+}
13 years, 11 months
JBoss Rich Faces SVN: r21021 - in modules/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-14 08:50:19 -0500 (Fri, 14 Jan 2011)
New Revision: 21021
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTableToggler/simple.xhtml
Log:
fixed attributes and samples for collapsibleSubTable
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java 2011-01-14 12:51:16 UTC (rev 21020)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java 2011-01-14 13:50:19 UTC (rev 21021)
@@ -95,6 +95,7 @@
attributes.setAttribute("rows", 5);
// TODO these attributes have to be tested in another way
+ attributes.remove("columns");
attributes.remove("selection");
attributes.remove("filterVar");
attributes.remove("keepSaved");
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties 2011-01-14 12:51:16 UTC (rev 21020)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties 2011-01-14 13:50:19 UTC (rev 21021)
@@ -1,6 +1,7 @@
attr.expandMode.server=server
attr.expandMode.ajax=ajax
attr.expandMode.client=client
+attr.expandMode.none=none
attr.expandMode.null=
attr.sortMode.single=single
attr.sortMode.multi=multi
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTableToggler/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTableToggler/simple.xhtml 2011-01-14 12:51:16 UTC (rev 21020)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTableToggler/simple.xhtml 2011-01-14 13:50:19 UTC (rev 21021)
@@ -66,7 +66,7 @@
</f:facet>
<rich:column id="columnTC" colspan="3">
- <rich:collapsibleSubTableToggler id="richSTTControl"
+ <rich:collapsibleSubTableToggler id="subTableTC"
collapseIcon="#{richSubTableTogglerBean.attributes['collapseIcon'].value}"
collapseLabel="#{richSubTableTogglerBean.attributes['collapseLabel'].value}"
event="#{richSubTableTogglerBean.attributes['event'].value}"
13 years, 11 months
JBoss Rich Faces SVN: r21020 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-14 07:51:16 -0500 (Fri, 14 Jan 2011)
New Revision: 21020
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
trunk/ui/input/ui/src/main/templates/select.template.xml
Log:
RF-10101 select: disabled works wrong
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14 12:27:00 UTC (rev 21019)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14 12:51:16 UTC (rev 21020)
@@ -23,6 +23,8 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
+ @Attribute
+ public abstract boolean isDisabled();
@Attribute()
public abstract boolean isEnableManualInput();
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss 2011-01-14 12:27:00 UTC (rev 21019)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss 2011-01-14 12:51:16 UTC (rev 21020)
@@ -60,6 +60,15 @@
height: 15px;
}
+.rf-sel-btn-dis {
+
+}
+
+.rf-sel-btn-dis .rf-sel-btn-arrow {
+ cursor: default;
+ background-image: "url(#{resource['org.richfaces:combo_down_button_dis.gif']})";
+}
+
.rf-sel-lst-cord{
position: absolute;
/* TODO nick - review: font-size: 0px; */
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-01-14 12:27:00 UTC (rev 21019)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-01-14 12:51:16 UTC (rev 21020)
@@ -113,7 +113,7 @@
this.clientItems = mergedOptions.items;
- if(mergedOptions.showControl) {
+ if(mergedOptions.showControl && !mergedOptions.disabled) {
this.btn = $(document.getElementById(id+"Button"));
this.btn.bind("mousedown", $.proxy(this.__onBtnMouseDown, this));
this.btn.bind("mouseup", $.proxy(this.__onMouseUp, this));
@@ -150,7 +150,8 @@
itemCss: "rf-sel-opt",
selectItemCss: "rf-sel-sel",
listCss: "rf-sel-lst-cord",
- changeDelay: 8
+ changeDelay: 8,
+ disabled: false
};
var REGEXP_TRIM = /^[\n\s]*(.*)[\n\s]*$/;
Modified: trunk/ui/input/ui/src/main/templates/select.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/select.template.xml 2011-01-14 12:27:00 UTC (rev 21019)
+++ trunk/ui/input/ui/src/main/templates/select.template.xml 2011-01-14 12:51:16 UTC (rev 21020)
@@ -35,7 +35,7 @@
</div>
<c:if test="#{component.attributes['showButton']}">
<c:if test="#{component.attributes['disabled']}">
- <div id="#{clientId}Button" class="rf-sel-btn">
+ <div id="#{clientId}Button" class="rf-sel-btn rf-sel-btn-dis">
<div class="rf-sel-btn-arrow"></div>
</div>
</c:if>
@@ -70,7 +70,7 @@
<cdk:scriptOption name="itemCss" value="rf-sel-opt" />
<cdk:scriptOption name="selectItemCss" value="#{concatClasses('rf-sel-sel', component.attributes['selectItemClass'])}" />
<cdk:scriptOption attributes="onbegin oncomplete onerror onbeforedomupdate onchange onblur onselectitem onfocus" wrapper="eventHandler"/>
- <cdk:scriptOption attributes="showControl defaultLabel enableManualInput selectFirst" />
+ <cdk:scriptOption attributes="showControl defaultLabel enableManualInput selectFirst disabled" />
</cdk:scriptObject>
new RichFaces.ui.Select("#{clientId}", #{toScriptArgs(options)});
</script>
13 years, 11 months
JBoss Rich Faces SVN: r21019 - in trunk: ui/common/ui/src/main/java/org/richfaces/component/util and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-14 07:27:00 -0500 (Fri, 14 Jan 2011)
New Revision: 21019
Modified:
trunk/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/util/HtmlUtil.java
trunk/ui/common/ui/src/test/java/org/richfaces/component/util/HtmlUtilTest.java
Log:
RF-10215 HtmlDimensions: formatSize corrections
Modified: trunk/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2011-01-14 12:09:00 UTC (rev 21018)
+++ trunk/core/api/src/main/java/org/richfaces/renderkit/util/HtmlDimensions.java 2011-01-14 12:27:00 UTC (rev 21019)
@@ -91,7 +91,7 @@
public static String formatSize(String size) {
if (size != null) {
String incomingSize = size.trim();
- if (!incomingSize.isEmpty()) {
+ if (incomingSize.length() > 0) {
char lastChar = incomingSize.charAt(incomingSize.length() - 1);
if (Character.isDigit(lastChar)) {
return incomingSize + "px";
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/util/HtmlUtil.java 2011-01-14 12:09:00 UTC (rev 21018)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/util/HtmlUtil.java 2011-01-14 12:27:00 UTC (rev 21019)
@@ -48,20 +48,6 @@
private HtmlUtil() {
}
- public static String qualifySize(String sizeDeclaration) {
- String trimmedValue = sizeDeclaration.trim();
-
- if (trimmedValue.length() != 0) {
- char lastChar = trimmedValue.charAt(trimmedValue.length() - 1);
-
- if (Character.isDigit(lastChar)) {
- return sizeDeclaration + "px";
- }
- }
-
- return sizeDeclaration;
- }
-
public static String addToSize(String declaration, String delta) {
Double doubleDelta = HtmlDimensions.decode(delta);
Double decoded = HtmlDimensions.decode(declaration);
Modified: trunk/ui/common/ui/src/test/java/org/richfaces/component/util/HtmlUtilTest.java
===================================================================
--- trunk/ui/common/ui/src/test/java/org/richfaces/component/util/HtmlUtilTest.java 2011-01-14 12:09:00 UTC (rev 21018)
+++ trunk/ui/common/ui/src/test/java/org/richfaces/component/util/HtmlUtilTest.java 2011-01-14 12:27:00 UTC (rev 21019)
@@ -47,17 +47,6 @@
super.tearDown();
}
- public void testQualifySize() throws Exception {
- assertEquals("", HtmlUtil.qualifySize(""));
- assertEquals("100px", HtmlUtil.qualifySize("100px"));
- assertEquals("100px", HtmlUtil.qualifySize("100"));
- assertEquals("100pt", HtmlUtil.qualifySize("100pt"));
- assertEquals("100in", HtmlUtil.qualifySize("100in"));
- assertEquals("100cm", HtmlUtil.qualifySize("100cm"));
- assertEquals("100em", HtmlUtil.qualifySize("100em"));
- assertEquals("100%", HtmlUtil.qualifySize("100%"));
- }
-
public void testAddToSize() throws Exception {
assertEquals("120px", HtmlUtil.addToSize("100", "20px"));
assertEquals("120px", HtmlUtil.addToSize("100px", "20"));
13 years, 11 months
JBoss Rich Faces SVN: r21018 - in trunk/ui/input/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-14 07:09:00 -0500 (Fri, 14 Jan 2011)
New Revision: 21018
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
RF-10096 Inline default values: input components III
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -47,7 +47,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
- @Attribute(defaultValue="InplaceState.ready")
+ @Attribute()
public abstract InplaceState getState();
@Attribute
@@ -62,7 +62,7 @@
@Attribute(defaultValue="true")
public abstract boolean isSaveOnBlur();
- @Attribute(defaultValue="false")
+ @Attribute()
public abstract boolean isShowControls();
@Attribute
@@ -80,7 +80,7 @@
@Attribute
public abstract String getListClass();
- @Attribute(defaultValue="click")
+ @Attribute()
public abstract String getEditEvent();
@Attribute(events=@EventName("inputclick"))
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -24,7 +24,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
- @Attribute(defaultValue="false")
+ @Attribute()
public abstract boolean isEnableManualInput();
@Attribute(defaultValue="true")
@@ -33,13 +33,13 @@
@Attribute(defaultValue="true")
public abstract boolean isShowButton();
- @Attribute(defaultValue="20px")
+ @Attribute()
public abstract String getMinListHeight();
- @Attribute(defaultValue="100px")
+ @Attribute()
public abstract String getMaxListHeight();
- @Attribute(defaultValue="auto")
+ @Attribute()
public abstract String getListHeight();
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -34,10 +34,10 @@
public abstract class AbstractSelectComponent extends UISelectOne {
- @Attribute(defaultValue="200px")
+ @Attribute()
public abstract String getListWidth();
- @Attribute(defaultValue="100px")
+ @Attribute()
public abstract String getListHeight();
@Attribute
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -211,7 +211,7 @@
}
protected String getEditEvent(UIComponent component) {
- String value = ((AbstractInplaceInput) component).getEditEvent();
+ String value = ((InplaceComponent) component).getEditEvent();
if (value == null || "".equals(value)) {
value = "click";
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -32,6 +32,7 @@
import org.richfaces.component.AbstractInplaceSelect;
import org.richfaces.component.InplaceComponent;
+import org.richfaces.renderkit.util.HtmlDimensions;
/**
* @author Anton Belevich
@@ -88,13 +89,29 @@
public String getListWidth(UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect)component;
- String width = select.getListWidth();
+ String width = getListWidth(select);
return (width != null && width.trim().length() != 0) ? ("width: " + width) : "";
}
+ protected String getListWidth(AbstractInplaceSelect select) {
+ String width = HtmlDimensions.formatSize(select.getListWidth());
+ if (width == null || width.length() == 0) {
+ width = "200px";
+ }
+ return width;
+ }
+
+ protected String getListHeight(AbstractInplaceSelect select) {
+ String height = HtmlDimensions.formatSize(select.getListHeight());
+ if (height == null || height.length() == 0) {
+ height = "100px";
+ }
+ return height;
+ }
+
public String getListHeight(UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect)component;
- String height = select.getListHeight();
+ String height = getListHeight(select);
return (height != null && height.trim().length() != 0) ? ("height: " + height) : "";
}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2011-01-14 12:09:00 UTC (rev 21018)
@@ -32,6 +32,7 @@
import org.richfaces.component.AbstractSelect;
import org.richfaces.component.AbstractSelectComponent;
+import org.richfaces.renderkit.util.HtmlDimensions;
/**
* @author abelevich
@@ -65,26 +66,58 @@
public String getListWidth(UIComponent component) {
AbstractSelect select = (AbstractSelect)component;
- String width = select.getListWidth();
+ String width = getListWidth(select);
return (width != null && width.trim().length() != 0) ? ("width: " + width) : "";
}
+ protected String getMinListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getMinListHeight());
+ if (height == null || height.length() == 0) {
+ height = "20px";
+ }
+ return height;
+ }
+
+ protected String getMaxListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getMaxListHeight());
+ if (height == null || height.length() == 0) {
+ height = "100px";
+ }
+ return height;
+ }
+
+ protected String getListHeight(AbstractSelect select) {
+ String height = HtmlDimensions.formatSize(select.getListHeight());
+ if (height == null || height.length() == 0) {
+ height = "auto";
+ }
+ return height;
+ }
+
+ protected String getListWidth(AbstractSelect select) {
+ String width = HtmlDimensions.formatSize(select.getListWidth());
+ if (width == null || width.length() == 0) {
+ width = "200px";
+ }
+ return width;
+ }
+
public String encodeHeightAndWidth(UIComponent component) {
AbstractSelect select = (AbstractSelect)component;
- String height = select.getListHeight();
+ String height = getListHeight(select);
if(!"auto".equals(height)) {
height = (height != null && height.trim().length() != 0) ? ("height: " + height) : "";
} else {
- String minHeight = select.getMinListHeight();
+ String minHeight = getMinListHeight(select);
minHeight = (minHeight != null && minHeight.trim().length() != 0) ? ("min-height: " + minHeight) : "";
- String maxHeight = select.getMaxListHeight();
+ String maxHeight = getMaxListHeight(select);
maxHeight = (maxHeight != null && maxHeight.trim().length() != 0) ? ("max-height: " + maxHeight) : "";
height = concatStyles(minHeight, maxHeight);
}
- String width = select.getListWidth();
+ String width = getListWidth(select);
width = (width != null && width.trim().length() != 0) ? ("width: " + width) : "";
return concatStyles(height, width);
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-14 11:59:55 UTC (rev 21017)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-14 12:09:00 UTC (rev 21018)
@@ -104,7 +104,8 @@
<cdk:scriptOption name="changedCss" value="#{concatClasses('rf-is-c-s', component.attributes['changedStateClass'])}"/>
<cdk:scriptOption name="editCss" value="#{concatClasses('rf-is-e-s', component.attributes['editStateClass'])}"/>
<cdk:scriptOption name="selectItemCss" value="#{concatClasses('rf-is-sel', component.attributes['selectItemClass'])}"/>
- <cdk:scriptOption attributes="editEvent state defaultLabel saveOnBlur showControls openOnEdit saveOnSelect inputWidth" />
+ <cdk:scriptOption name="editEvent" value="#{getEditEvent(component)}"/>
+ <cdk:scriptOption attributes="state defaultLabel saveOnBlur showControls openOnEdit saveOnSelect inputWidth" />
<cdk:scriptOption attributes="onbegin oncomplete onerror onbeforedomupdate onselectitem onchange onblur onfocus" wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceSelect("#{clientId}", #{toScriptArgs(options)});
13 years, 11 months
JBoss Rich Faces SVN: r21017 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-14 06:59:55 -0500 (Fri, 14 Jan 2011)
New Revision: 21017
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
Log:
following changes in library (guard/guardInterlayed) + added support for select for many multiple choices
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-14 11:35:10 UTC (rev 21016)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-14 11:59:55 UTC (rev 21017)
@@ -22,6 +22,7 @@
package org.richfaces.tests.metamer.ftest;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guard;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -35,6 +36,7 @@
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.option.OptionValueLocator;
import org.jboss.test.selenium.locator.reference.LocatorReference;
import org.jboss.test.selenium.locator.reference.ReferencedLocator;
import org.jboss.test.selenium.request.RequestType;
@@ -48,7 +50,7 @@
protected AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
LocatorReference<ExtendedLocator<JQueryLocator>> root = new LocatorReference<ExtendedLocator<JQueryLocator>>(
pjq(""));
- ReferencedLocator<JQueryLocator> propertyLocator = referenceInferred(root, "input[id*={0}Input]{1}");
+ ReferencedLocator<JQueryLocator> propertyLocator = referenceInferred(root, "*[id*={0}Input]{1}");
RequestType requestType = RequestType.HTTP;
@@ -65,12 +67,15 @@
}
protected void setProperty(String propertyName, Object value) {
- ElementLocator<?> locator = propertyLocator.format(propertyName);
+ ExtendedLocator<JQueryLocator> locator = propertyLocator.format(propertyName);
final AttributeLocator<?> typeLocator = locator.getAttribute(Attribute.TYPE);
+ final ExtendedLocator<JQueryLocator> optionLocator = locator.getChild(jq("option"));
String inputType = null;
if (selenium.getCount(propertyLocator.format(propertyName)) > 1) {
inputType = "radio";
+ } else if (selenium.getCount(optionLocator) > 1) {
+ inputType = "select";
} else {
inputType = selenium.getAttribute(typeLocator);
}
@@ -100,6 +105,8 @@
if (!selenium.isChecked(locator)) {
applyRadio(locator);
}
+ } else if ("select".equals(inputType)) {
+ applySelect(locator, valueAsString);
}
}
@@ -112,15 +119,20 @@
}
protected void applyText(ElementLocator<?> locator, String value) {
- guard(selenium, requestType, false).type(locator, value);
+ guard(selenium, requestType).type(locator, value);
}
protected void applyCheckbox(ElementLocator<?> locator, boolean checked) {
selenium.check(locator, checked);
- guard(selenium, requestType, false).fireEvent(locator, Event.CHANGE);
+ guard(selenium, requestType).fireEvent(locator, Event.CHANGE);
}
protected void applyRadio(ElementLocator<?> locator) {
- guard(selenium, requestType, false).click(locator);
+ guard(selenium, requestType).click(locator);
}
+
+ protected void applySelect(ElementLocator<?> locator, String value) {
+ OptionValueLocator optionLocator = new OptionValueLocator(value);
+ guard(selenium, requestType).select(locator, optionLocator);
+ }
}
13 years, 11 months
JBoss Rich Faces SVN: r21016 - modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-14 06:35:10 -0500 (Fri, 14 Jan 2011)
New Revision: 21016
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
Log:
* fixed page title
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml 2011-01-14 05:53:15 UTC (rev 21015)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml 2011-01-14 11:35:10 UTC (rev 21016)
@@ -5,7 +5,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -27,7 +27,7 @@
<ui:composition template="/templates/list.xhtml">
- <ui:define name="pageTitle">Rich Calendar</ui:define>
+ <ui:define name="pageTitle">Rich Drop Down Menu</ui:define>
<ui:define name="links">
13 years, 11 months