JBoss Rich Faces SVN: r19315 - in trunk/ui/input/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-09-22 09:22:14 -0400 (Wed, 22 Sep 2010)
New Revision: 19315
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
trunk/ui/input/ui/src/main/templates/input.template.inc
trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml
Log:
RF-9302
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-09-22 12:14:30 UTC (rev 19314)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-09-22 13:22:14 UTC (rev 19315)
@@ -19,31 +19,31 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-.rf-ins, .rf-ins-ta {
+.rf-insl, .rf-insl-trc-cntr {
display: inline-block;
}
-.rf-ins {
+.rf-insl {
white-space: nowrap;
}
-.rf-ins-ta {
+.rf-insl-trc-cntr {
width: 200px; /*TODO remove it*/
vertical-align: top;
}
-.rf-ins-mn, .rf-ins-mx, input.rf-ins-i, .rf-ins-tt {
+.rf-insl-mn, .rf-insl-mx, input.rf-insl-inp, .rf-insl-tt {
font-size: '#{richSkin.generalSizeFont}';
font-family: '#{richSkin.generalFamilyFont}';
color: '#{richSkin.generalTextColor}';
}
-.rf-ins-mn, .rf-ins-mx {
+.rf-insl-mn, .rf-insl-mx {
display: block;
margin-bottom: 3px;
}
-.rf-ins-mn {
+.rf-insl-mn {
border-left-width: 1px;
border-left-style: solid;
border-left-color: '#{richSkin.panelBorderColor}';
@@ -51,7 +51,7 @@
float: left;
}
-.rf-ins-mx {
+.rf-insl-mx {
border-right-width: 1px;
border-right-style: solid;
border-right-color: '#{richSkin.panelBorderColor}';
@@ -60,12 +60,12 @@
text-align: right;
}
-.rf-ins-ci {
+.rf-insl-inp-cntr {
margin: 0px;
vertical-align: bottom;
}
-input.rf-ins-i {
+input.rf-insl-inp {
background: url("#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']}") top repeat-x;
background-color: '#{richSkin.controlBackgroundColor}';
border-width: 1px;
@@ -75,7 +75,7 @@
vertical-align: bottom;
}
-.rf-ins-tt {
+.rf-insl-tt {
position: absolute;
display: none;
/* TODO padding: 2px;
@@ -83,7 +83,7 @@
background-color: '#{richSkin.tipBackgroundColor}';*/
}
-.rf-ins-t {
+.rf-insl-trc {
background: url("#{resource['org.richfaces.images:insldrTrackGrad.png']}") 1px 1px repeat-x;
background-color: '#{richSkin.controlBackgroundColor}';
border-width: 1px;
@@ -97,53 +97,53 @@
font-size: 0px;
}
-.rf-ins-h, .rf-ins-h-d, .rf-ins-db, .rf-ins-ib, .rf-ins-db-d, .rf-ins-ib-d {
+.rf-insl-hnd, .rf-insl-hnd-dis, .rf-insl-dec, .rf-insl-inc, .rf-insl-dec-dis, .rf-insl-inc-dis {
display: inline-block;
width: 7px;
height: 7px;
}
-.rf-ins-h, .rf-ins-h-d {
+.rf-insl-hnd, .rf-insl-hnd-dis {
vertical-align: top;
}
-.rf-ins-db, .rf-ins-ib, .rf-ins-db-d, .rf-ins-ib-d {
+.rf-insl-dec, .rf-insl-inc, .rf-insl-dec-dis, .rf-insl-inc-dis {
vertical-align: bottom;
}
-.rf-ins-h {
+.rf-insl-hnd {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderArrowBottom']}");
}
-.rf-ins-h-s {
+.rf-insl-hnd-sel {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowBottom']}");
}
-.rf-ins-h-d {
+.rf-insl-hnd-dis {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowBottom']}");
}
-.rf-ins-db {
+.rf-insl-dec {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderArrowLeft']}");
}
-.rf-ins-db-s {
+.rf-insl-dec-sel {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowLeft']}");
}
-.rf-ins-db-d {
+.rf-insl-dec-dis {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowLeft']}");
}
-.rf-ins-ib {
+.rf-insl-inc {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderArrowRight']}");
}
-.rf-ins-ib-s {
+.rf-insl-inc-sel {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowRight']}");
}
-.rf-ins-ib-d {
+.rf-insl-inc-dis {
background-image: url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowRight']}");
}
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-09-22 12:14:30 UTC (rev 19314)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-09-22 13:22:14 UTC (rev 19315)
@@ -32,25 +32,25 @@
step: 1,
tabIndex: 0,
- decreaseSelectedClass: "rf-ins-db-s",
- handleSelectedClass: "rf-ins-h-s",
- increaseSelectedClass: "rf-ins-ib-s",
+ decreaseSelectedClass: "rf-insl-dec-sel",
+ handleSelectedClass: "rf-insl-hnd-sel",
+ increaseSelectedClass: "rf-insl-inc-sel",
init: function (id, options, selectedClasses) {
jQuery.extend(this, options);
this.range = this.maxValue - this.minValue;
this.id = id;
this.element = jQuery(this.attachToDom());
- this.input = this.element.children(".rf-ins-ci").children(".rf-ins-i");
- this.track = this.element.children(".rf-ins-ta").children(".rf-ins-t");
- this.handle = this.track.children(".rf-ins-h, .rf-ins-h-d");
- this.tooltip = this.element.children(".rf-ins-tt");
+ this.input = this.element.children(".rf-insl-inp-cntr").children(".rf-insl-inp");
+ this.track = this.element.children(".rf-insl-trc-cntr").children(".rf-insl-trc");
+ this.handle = this.track.children(".rf-insl-hnd, .rf-insl-hnd-dis");
+ this.tooltip = this.element.children(".rf-insl-tt");
this.__inputHandler();
if (!this.disabled) {
- this.decreaseButton = this.element.children(".rf-ins-db");
- this.increaseButton = this.element.children(".rf-ins-ib");
+ this.decreaseButton = this.element.children(".rf-insl-dec");
+ this.increaseButton = this.element.children(".rf-insl-inc");
this.track[0].tabIndex = this.tabIndex;
Modified: trunk/ui/input/ui/src/main/templates/input.template.inc
===================================================================
--- trunk/ui/input/ui/src/main/templates/input.template.inc 2010-09-22 12:14:30 UTC (rev 19314)
+++ trunk/ui/input/ui/src/main/templates/input.template.inc 2010-09-22 13:22:14 UTC (rev 19315)
@@ -22,9 +22,9 @@
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<span class="rf-ins-ci">
+<span class="rf-insl-inp-cntr">
<input xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" name="#{clientId}" type="text"
- class="rf-ins-i #{component.attributes['inputClass']}" value="#{getInputValue(facesContext, component)}"
+ class="rf-insl-inp #{component.attributes['inputClass']}" value="#{getInputValue(facesContext, component)}"
cdk:passThrough="accesskey disabled maxlength size:inputSize tabindex" readonly="#{!component.attributes['enableManualInput']}"
style="#{component.attributes['showInput'] ? null : 'display: none;'}" />
</span>
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-09-22 12:14:30 UTC (rev 19314)
+++ trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-09-22 13:22:14 UTC (rev 19315)
@@ -37,7 +37,7 @@
<cdk:resource-dependency library="org.richfaces" name="inputNumberSlider.js" />
</cc:interface>
<cc:implementation>
- <span id="#{clientId}" class="rf-ins #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
+ <span id="#{clientId}" class="rf-insl #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
<c:if test="#{isInputPosition(component, 'left') || isInputPosition(component, 'top')}">
<xi:include xpointer="xpointer(/*)" href="input.template.inc" />
<c:if test="#{isInputPosition(component, 'top') and component.attributes['showInput']}">
@@ -45,19 +45,19 @@
</c:if>
</c:if>
<c:if test="#{component.attributes['showArrows']}">
- <span class="rf-ins-db#{component.attributes['disabled'] ? '-d' : ''} #{component.attributes['decreaseClass']}" />
+ <span class="rf-insl-dec#{component.attributes['disabled'] ? '-dis' : ''} #{component.attributes['decreaseClass']}" />
</c:if>
- <span class="rf-ins-ta">
+ <span class="rf-insl-trc-cntr">
<c:if test="#{component.attributes['showBoundaryValues']}">
- <span class="rf-ins-mn">#{component.attributes['minValue']}</span>
- <span class="rf-ins-mx">#{component.attributes['maxValue']}</span>
+ <span class="rf-insl-mn">#{component.attributes['minValue']}</span>
+ <span class="rf-insl-mx">#{component.attributes['maxValue']}</span>
</c:if>
- <span class="rf-ins-t #{component.attributes['trackClass']}">
- <span class="rf-ins-h#{component.attributes['disabled'] ? '-d' : ''} #{component.attributes['handleClass']}" />
+ <span class="rf-insl-trc #{component.attributes['trackClass']}">
+ <span class="rf-insl-hnd#{component.attributes['disabled'] ? '-dis' : ''} #{component.attributes['handleClass']}" />
</span>
</span>
<c:if test="#{component.attributes['showArrows']}">
- <span class="rf-ins-ib#{component.attributes['disabled'] ? '-d' : ''} #{component.attributes['increaseClass']}" />
+ <span class="rf-insl-inc#{component.attributes['disabled'] ? '-dis' : ''} #{component.attributes['increaseClass']}" />
</c:if>
<c:if test="#{isInputPosition(component, 'right') || isInputPosition(component, 'bottom')}">
<c:if test="#{isInputPosition(component, 'bottom') and component.attributes['showInput']}">
@@ -66,7 +66,7 @@
<xi:include xpointer="xpointer(/*)" href="input.template.inc" />
</c:if>
<c:if test="#{component.attributes['showToolTip']}">
- <span class="rf-ins-tt #{component.attributes['toolTipClass']}">#{getInputValue(facesContext, component)}</span>
+ <span class="rf-insl-tt #{component.attributes['toolTipClass']}">#{getInputValue(facesContext, component)}</span>
</c:if>
<script type="text/javascript">new RichFaces.ui.InputNumberSlider('#{clientId}', {
delay: #{component.attributes['delay']},
14 years, 3 months
JBoss Rich Faces SVN: r19314 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-22 08:14:30 -0400 (Wed, 22 Sep 2010)
New Revision: 19314
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
Log:
https://jira.jboss.org/browse/RFPL-817
* tests for command button refactored
* added 9 tests for command link
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java 2010-09-22 12:14:30 UTC (rev 19314)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jAjax;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Abstract test case for testing h:commandButton and h:commandLink with a4j:ajax.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestCommand extends AbstractMetamerTest {
+
+ private JQueryLocator input = pjq("input[type=text][id$=input]");
+ private JQueryLocator output1 = pjq("div[id$=output1]");
+ private JQueryLocator output2 = pjq("div[id$=output2]");
+
+ public void testClick(JQueryLocator command, String text) {
+ selenium.type(input, text);
+ guardXhr(selenium).click(command);
+ String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, text, "Wrong output1");
+ assertEquals(selenium.getText(output2), text, "Wrong output2");
+ }
+
+ public void testBypassUpdates(JQueryLocator command) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testData(JQueryLocator command) {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.type(input, "some input text");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax request");
+ }
+
+ public void testImmediate(JQueryLocator command) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "RichFaces 4", "Output should change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testImmediateBypassUpdates(JQueryLocator command) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testLimitRender(JQueryLocator command) {
+ selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ }
+
+ public void testEvents(JQueryLocator command) {
+ selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "metamerEvents += \"complete \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ }
+
+ public void testRender(JQueryLocator command) {
+ selenium.type(pjq("input[type=text][id$=renderInput]"), "output1");
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "RichFaces 4", "Wrong output1");
+ assertEquals(selenium.getText(output2), "", "Wrong output2");
+
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2010-09-22 11:38:58 UTC (rev 19313)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2010-09-22 12:14:30 UTC (rev 19314)
@@ -21,18 +21,11 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jAjax;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
import java.net.URL;
-import javax.faces.event.PhaseId;
-
-import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.Test;
/**
@@ -41,13 +34,10 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class TestHCommandButton extends AbstractMetamerTest {
+public class TestHCommandButton extends AbstractTestCommand {
- private JQueryLocator input = pjq("input[type=text][id$=input]");
private JQueryLocator button = pjq("input[type=submit][id$=commandButton]");
- private JQueryLocator output1 = pjq("div[id$=output1]");
- private JQueryLocator output2 = pjq("div[id$=output2]");
-
+
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/a4jAjax/hCommandButton.xhtml");
@@ -55,146 +45,46 @@
@Test
public void testSimpleClick() {
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
-
- assertEquals(outputValue, "RichFaces 4", "Wrong output1");
- assertEquals(selenium.getText(output2), "RichFaces 4", "Wrong output2");
+ super.testClick(button, "RichFaces 4");
}
@Test
public void testSimpleClickUnicode() {
- selenium.type(input, "ľščťžýáíéúôň фывацукйешгщь");
- guardXhr(selenium).click(button);
- String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
-
- assertEquals(outputValue, "ľščťžýáíéúôň фывацукйешгщь", "Wrong output1");
- assertEquals(selenium.getText(output2), "ľščťžýáíéúôň фывацукйешгщь", "Wrong output2");
+ super.testClick(button, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- JQueryLocator time = jq("span[id$=requestTime]");
- String timeValue = selenium.getText(time);
-
- selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
- selenium.waitForPageToLoad();
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
-
- assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.RENDER_RESPONSE);
+ super.testBypassUpdates(button);
}
@Test
public void testData() {
- selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4");
- selenium.waitForPageToLoad();
-
- selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
- selenium.waitForPageToLoad();
-
- JQueryLocator time = jq("span[id$=requestTime]");
- String timeValue = selenium.getText(time);
-
- selenium.type(input, "some input text");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
-
- String data = selenium.getEval(new JavaScript("window.data"));
- assertEquals(data, "RichFaces 4", "Data sent with ajax request");
+ super.testData(button);
}
@Test
public void testImmediate() {
- JQueryLocator time = jq("span[id$=requestTime]");
- String timeValue = selenium.getText(time);
-
- selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
- selenium.waitForPageToLoad();
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
-
- assertEquals(selenium.getText(output1), "RichFaces 4", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ super.testImmediate(button);
}
@Test
public void testImmediateBypassUpdates() {
- JQueryLocator time = jq("span[id$=requestTime]");
- String timeValue = selenium.getText(time);
-
- selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
- selenium.waitForPageToLoad();
- selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
- selenium.waitForPageToLoad();
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
-
- assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ super.testImmediateBypassUpdates(button);
}
@Test
public void testLimitRender() {
- selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
- selenium.waitForPageToLoad();
-
- JQueryLocator time = jq("span[id$=requestTime]");
- String timeValue = selenium.getText(time);
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
-
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ super.testLimitRender(button);
}
@Test
public void testEvents() {
- selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
- selenium.waitForPageToLoad();
- selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
- selenium.waitForPageToLoad();
- selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "metamerEvents += \"complete \"");
- selenium.waitForPageToLoad();
-
- selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
-
- String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
-
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ super.testEvents(button);
}
@Test
public void testRender() {
- selenium.type(pjq("input[type=text][id$=renderInput]"), "output1");
- selenium.waitForPageToLoad();
-
- selenium.type(input, "RichFaces 4");
- guardXhr(selenium).click(button);
- String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
-
- assertEquals(outputValue, "RichFaces 4", "Wrong output1");
- assertEquals(selenium.getText(output2), "", "Wrong output2");
-
+ super.testEvents(button);
}
}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java 2010-09-22 12:14:30 UTC (rev 19314)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jAjax;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hCommandLink.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHCommandLink extends AbstractTestCommand {
+
+ private JQueryLocator link = pjq("a[id$=commandLink]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jAjax/hCommandLink.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ super.testClick(link, "RichFaces 4");
+ }
+
+ @Test
+ public void testSimpleClickUnicode() {
+ super.testClick(link, "ľščťžýáíéúôň фывацукйешгщь");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ super.testBypassUpdates(link);
+ }
+
+ @Test
+ public void testData() {
+ super.testData(link);
+ }
+
+ @Test
+ public void testImmediate() {
+ super.testImmediate(link);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ super.testImmediateBypassUpdates(link);
+ }
+
+ @Test
+ public void testLimitRender() {
+ super.testLimitRender(link);
+ }
+
+ @Test
+ public void testEvents() {
+ super.testEvents(link);
+ }
+
+ @Test
+ public void testRender() {
+ super.testEvents(link);
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java
___________________________________________________________________
Name: svn:keywords
+ Revision
14 years, 3 months
JBoss Rich Faces SVN: r19313 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-22 07:38:58 -0400 (Wed, 22 Sep 2010)
New Revision: 19313
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
Log:
https://jira.jboss.org/browse/RFPL-817
* added test for immediate in h:commandButton
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2010-09-22 11:26:05 UTC (rev 19312)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2010-09-22 11:38:58 UTC (rev 19313)
@@ -19,7 +19,6 @@
* 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.a4jAjax;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
@@ -59,7 +58,7 @@
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(button);
String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
+ retrieveText.locator(output1));
assertEquals(outputValue, "RichFaces 4", "Wrong output1");
assertEquals(selenium.getText(output2), "RichFaces 4", "Wrong output2");
@@ -70,7 +69,7 @@
selenium.type(input, "ľščťžýáíéúôň фывацукйешгщь");
guardXhr(selenium).click(button);
String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
+ retrieveText.locator(output1));
assertEquals(outputValue, "ľščťžýáíéúôň фывацукйешгщь", "Wrong output1");
assertEquals(selenium.getText(output2), "ľščťžýáíéúôň фывацукйешгщь", "Wrong output2");
@@ -90,7 +89,7 @@
assertEquals(selenium.getText(output1), "", "Output should not change");
assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.RENDER_RESPONSE);
+ PhaseId.RENDER_RESPONSE);
}
@Test
@@ -113,6 +112,23 @@
}
@Test
+ public void testImmediate() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(button);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "RichFaces 4", "Output should change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
public void testImmediateBypassUpdates() {
JQueryLocator time = jq("span[id$=requestTime]");
String timeValue = selenium.getText(time);
@@ -175,7 +191,7 @@
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(button);
String outputValue = waitGui.failWith("Page was not updated").waitForChangeAndReturn("",
- retrieveText.locator(output1));
+ retrieveText.locator(output1));
assertEquals(outputValue, "RichFaces 4", "Wrong output1");
assertEquals(selenium.getText(output2), "", "Wrong output2");
14 years, 3 months
JBoss Rich Faces SVN: r19312 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-09-22 07:26:05 -0400 (Wed, 22 Sep 2010)
New Revision: 19312
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
Log:
Fix styles for popup
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-09-22 11:21:34 UTC (rev 19311)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-09-22 11:26:05 UTC (rev 19312)
@@ -41,7 +41,7 @@
cursor : move;
padding : 2px;
}
-.rf-pp-hdr-�nt {
+.rf-pp-hdr-cnt {
overflow : hidden;
white-space : nowrap;
text-overflow: ellipsis;
14 years, 3 months
JBoss Rich Faces SVN: r19311 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-22 07:21:34 -0400 (Wed, 22 Sep 2010)
New Revision: 19311
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
Log:
https://jira.jboss.org/browse/RFPL-717
* testBypassUpdates and testImmediate refactored
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2010-09-22 11:16:19 UTC (rev 19310)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2010-09-22 11:21:34 UTC (rev 19311)
@@ -19,7 +19,6 @@
* 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.a4jJSFunction;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
@@ -30,6 +29,7 @@
import static org.testng.Assert.assertNotSame;
import java.net.URL;
+import javax.faces.event.PhaseId;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.encapsulated.JavaScript;
@@ -50,7 +50,6 @@
private JQueryLocator time2 = pjq("span[id$=time2]");
private JQueryLocator year = pjq("span[id$=year]");
private JQueryLocator ajaxRenderedTime = pjq("span[id$=autoTime]");
-
private String[] phasesNames = {"RESTORE_VIEW 1", "APPLY_REQUEST_VALUES 2", "PROCESS_VALIDATIONS 3",
"UPDATE_MODEL_VALUES 4", "INVOKE_APPLICATION 5", "RENDER_RESPONSE 6"};
@@ -69,7 +68,7 @@
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
String newTime2Value = selenium.getText(time2);
String newYearValue = selenium.getText(year);
String newAjaxRenderedTimeValue = selenium.getText(ajaxRenderedTime);
@@ -91,13 +90,13 @@
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 1, "Action was not called");
guardXhr(selenium).click(link);
newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 2, "Action was not called");
}
@@ -113,13 +112,13 @@
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 1, "Action was not called");
guardXhr(selenium).click(link);
newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 2, "Action was not called");
}
@@ -138,12 +137,8 @@
JQueryLocator[] phases = {jq("div#phasesPanel li"), jq("div#phasesPanel li:eq(0)"),
jq("div#phasesPanel li:eq(1)"), jq("div#phasesPanel li:eq(2)"), jq("div#phasesPanel li:eq(3)")};
- final String msg = "Update model values and Invoke application phases should be skipped.";
- assertEquals(selenium.getCount(phases[0]), 4, msg);
- assertEquals(selenium.getText(phases[1]), phasesNames[0], msg);
- assertEquals(selenium.getText(phases[2]), phasesNames[1], msg);
- assertEquals(selenium.getText(phases[3]), phasesNames[2], msg);
- assertEquals(selenium.getText(phases[4]), phasesNames[5], msg);
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
}
@Test
@@ -157,14 +152,7 @@
guardXhr(selenium).click(link);
waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time1));
- JQueryLocator[] phases = {jq("div#phasesPanel li"), jq("div#phasesPanel li:eq(0)"),
- jq("div#phasesPanel li:eq(1)"), jq("div#phasesPanel li:eq(2)")};
-
- final String msg = "Process validations, Update model values and Invoke application phases should be skipped.";
- assertEquals(selenium.getCount(phases[0]), 3, msg);
- assertEquals(selenium.getText(phases[1]), phasesNames[0], msg);
- assertEquals(selenium.getText(phases[2]), phasesNames[1], msg);
- assertEquals(selenium.getText(phases[3]), phasesNames[5], msg);
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -184,7 +172,7 @@
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
String newTime2Value = selenium.getText(time2);
String newYearValue = selenium.getText(year);
String newAjaxRenderedTimeValue = selenium.getText(ajaxRenderedTime);
@@ -232,7 +220,7 @@
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
- retrieveText.locator(time1));
+ retrieveText.locator(time1));
String newTime2Value = selenium.getText(time2);
String newYearValue = selenium.getText(year);
String newAjaxRenderedTimeValue = selenium.getText(ajaxRenderedTime);
@@ -267,5 +255,4 @@
assertEquals(newYearValue, yearValue, "Year should not change");
assertEquals(newAjaxRenderedTimeValue, ajaxRenderedTimeValue, "Ajax rendered time should not change");
}
-
}
14 years, 3 months
JBoss Rich Faces SVN: r19310 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-22 07:16:19 -0400 (Wed, 22 Sep 2010)
New Revision: 19310
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java
Log:
fixed checkstyle violations for a4j:repeat tests
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java 2010-09-22 11:15:40 UTC (rev 19309)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java 2010-09-22 11:16:19 UTC (rev 19310)
@@ -39,12 +39,12 @@
*/
public class SimpleModel {
- private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+ Map<Integer, String> texts = new HashMap<Integer, String>();
JQueryLocator row = jq("#list li");
JQueryLocator statuses = jq("span.statuses");
- Map<Integer, String> texts = new HashMap<Integer, String>();
+ private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
public boolean isRendered() {
return selenium.isElementPresent(row);
14 years, 3 months
JBoss Rich Faces SVN: r19309 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-22 07:15:40 -0400 (Wed, 22 Sep 2010)
New Revision: 19309
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestMatrix.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml
Log:
added a4j:repeat - matrix sample tests (RFPL-819)
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml 2010-09-22 11:04:00 UTC (rev 19308)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml 2010-09-22 11:15:40 UTC (rev 19309)
@@ -52,19 +52,19 @@
styleClass="cell #{rowStatus.even ? 'row-even' : 'row-odd'} #{cellStatus.even ? 'cell-even' : 'cell-odd'}">
<h:inputText id="valueInput" value="#{cell.value}" size="3">
<f:convertNumber id="valueConvertNumber" />
- <a4j:ajax id="valueInputAjax" render="matrixInput matrixOutput" />
+ <a4j:ajax id="valueInputAjax" render="form:outputRows:#{rowStatus.index}:outputColumns:#{cellStatus.index}:output" />
</h:inputText>
<h:commandLink id="clearLink" action="#{cell.clearValueAction}" value="C">
- <a4j:ajax render="matrixInput matrixOutput" />
+ <a4j:ajax render="form:a4jRepeatRows:#{rowStatus.index}:a4jRepeatColumns:#{cellStatus.index}:valueInput form:outputRows:#{rowStatus.index}:outputColumns:#{cellStatus.index}:output" />
</h:commandLink>
<h:outputText value=" / " />
<h:commandLink id="increaseLink" action="#{cell.increaseValueAction}" value="+">
- <a4j:ajax render="matrixInput matrixOutput" />
+ <a4j:ajax render="form:a4jRepeatRows:#{rowStatus.index}:a4jRepeatColumns:#{cellStatus.index}:valueInput form:outputRows:#{rowStatus.index}:outputColumns:#{cellStatus.index}:output" />
</h:commandLink>
<h:outputText value=" / " />
<h:commandLink id="decreaseLink" action="#{cell.decreaseValueAction}" value="-">
- <a4j:ajax render="matrixInput matrixOutput" />
+ <a4j:ajax render="form:a4jRepeatRows:#{rowStatus.index}:a4jRepeatColumns:#{cellStatus.index}:valueInput form:outputRows:#{rowStatus.index}:outputColumns:#{cellStatus.index}:output" />
</h:commandLink>
</h:panelGroup></td>
</a4j:repeat>
@@ -74,21 +74,21 @@
</table>
</h:panelGroup>
<hr/>
- <h:panelGroup id="matrixOutput" layout="block">
+ <a4j:outputPanel id="matrixOutput" layout="block">
<table>
<tbody>
- <a4j:repeat value="#{a4jRepeatBean.matrixRows}" var="row">
+ <a4j:repeat id="outputRows" value="#{a4jRepeatBean.matrixRows}" var="row">
<tr>
- <a4j:repeat value="#{row.cells}" var="cell">
- <td><h:panelGroup styleClass="cell" layout="block">
+ <a4j:repeat id="outputColumns" value="#{row.cells}" var="cell">
+ <td><a4j:outputPanel id="output" styleClass="cell" layout="block">
#{cell.value}
- </h:panelGroup></td>
+ </a4j:outputPanel></td>
</a4j:repeat>
</tr>
</a4j:repeat>
</tbody>
</table>
- </h:panelGroup>
+ </a4j:outputPanel>
</ui:define>
<ui:define name="outOfTemplateAfter">
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestMatrix.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestMatrix.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestMatrix.java 2010-09-22 11:15:40 UTC (rev 19309)
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jRepeat;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.waitXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.Vector;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestMatrix extends AbstractMetamerTest {
+
+ Vector<Vector<Integer>> matrix;
+ Coordinate coordinate;
+
+ JQueryLocator inputRow = pjq("div[id$=matrixInput] > table > tbody > tr");
+ JQueryLocator outputRow = pjq("div[id$=matrixOutput] > table > tbody > tr");
+ JQueryLocator column = jq("div.cell");
+
+ int rows;
+ int columns;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jRepeat/matrix.xhtml");
+ }
+
+ @BeforeMethod
+ public void initializeTest() {
+ initializeMatrixProperties();
+ initializeMatrix();
+ }
+
+ @Test
+ public void testIncrementing() {
+ coordinate = new Coordinate(2, rows - 1);
+ coordinate.increase();
+ coordinate.increase();
+
+ coordinate = new Coordinate(columns, 2);
+ coordinate.increase();
+ coordinate.increase();
+ coordinate.increase();
+ coordinate.increase();
+
+ checkMatrix();
+ }
+
+ @Test
+ public void testDecrementing() {
+ coordinate = new Coordinate(2, 1);
+ coordinate.decrease();
+ coordinate.decrease();
+
+ coordinate = new Coordinate(columns - 1, rows - 1);
+ coordinate.decrease();
+ coordinate.decrease();
+ coordinate.decrease();
+
+ coordinate = new Coordinate(columns, rows);
+ coordinate.decrease();
+
+ checkMatrix();
+ }
+
+ @Test
+ public void testChanging() {
+ new Coordinate(1, rows).change(42);
+ new Coordinate(2, 2).change(-127);
+ new Coordinate(1, rows).change(89);
+
+ checkMatrix();
+ }
+
+ @Test
+ public void testClear() {
+ coordinate = new Coordinate(columns, 1);
+ coordinate.change(5);
+
+ coordinate = new Coordinate(1, rows);
+ coordinate.change(63);
+ coordinate.clear();
+
+ coordinate = new Coordinate(columns - 1, 1);
+ coordinate.change(-87);
+ coordinate.clear();
+
+ checkMatrix();
+ }
+
+ @Test
+ public void testMatrixAfterRefresh() {
+ testChanging();
+
+ refreshAll();
+
+ checkMatrix();
+ }
+
+ private void initializeMatrixProperties() {
+ rows = selenium.getCount(inputRow);
+ assertTrue(rows > 3, format("there should be more at least 4 rows in input matrix, but found {0}", rows));
+
+ columns = selenium.getCount(inputRow.getNthOccurence(1).getDescendant(column));
+ assertTrue(columns > 3,
+ format("there should be more at least 4 columns in input matrix, but found {0}", columns));
+
+ int cells = selenium.getCount(inputRow.getDescendant(column));
+ assertEquals(cells, rows * columns,
+ format("there should be totally {0} cells, but {1} was found", rows * columns, cells));
+
+ assertEquals(selenium.getCount(outputRow), rows,
+ "there should be same number of rows in outputMatrix like in outputMatrix");
+
+ assertEquals(selenium.getCount(outputRow.getDescendant(column)), cells,
+ "there should be same number of cells in outputMatrix like in outputMatrix");
+ }
+
+ private void initializeMatrix() {
+ matrix = new Vector<Vector<Integer>>(columns);
+ for (int x = 0; x < columns; x++) {
+ matrix.add(x, new Vector<Integer>(rows));
+ for (int y = 0; y < rows; y++) {
+ matrix.get(x).add(y, 0);
+ }
+ }
+ }
+
+ private void refreshAll() {
+ waitXhr(selenium).click(jq("img#controlsForm\\:reRenderAllImage"));
+ }
+
+ private void checkMatrix() {
+ new MatrixCommand() {
+ public void processCell(int x, int y) {
+ coordinate = new Coordinate(x, y);
+ coordinate.check();
+ }
+ }.processAll();
+ }
+
+ private class Coordinate {
+ private int x;
+ private int y;
+
+ private JQueryLocator input = jq("input:text[id$=valueInput]");
+ private JQueryLocator increaseLink = jq("a[id$=increaseLink]");
+ private JQueryLocator decreaseLink = jq("a[id$=decreaseLink]");
+ private JQueryLocator clearLink = jq("a[id$=clearLink]");
+
+ public Coordinate(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public void increase() {
+ waitXhr(selenium).click(getInputCell().getDescendant(increaseLink));
+ addValue(1);
+ check();
+ }
+
+ public void decrease() {
+ waitXhr(selenium).click(getInputCell().getDescendant(decreaseLink));
+ addValue(-1);
+ check();
+ }
+
+ public void clear() {
+ waitXhr(selenium).click(getInputCell().getDescendant(clearLink));
+ setValue(0);
+ check();
+ }
+
+ public void change(int newValue) {
+ changeInputValue(newValue);
+ setValue(newValue);
+ check();
+ }
+
+ public int obtainOutputValue() {
+ return Integer.valueOf(selenium.getText(getOutputCell()));
+ }
+
+ public int obtainInputValue() {
+ return Integer.valueOf(selenium.getValue(getInputCell().getDescendant(input)));
+ }
+
+ public void changeInputValue(int newValue) {
+ JQueryLocator locator = getInputCell().getDescendant(input);
+ waitXhr(selenium).type(locator, Integer.toString(newValue));
+ }
+
+ public void check() {
+ checkInputValue();
+ checkOutputValue();
+ }
+
+ public void checkInputValue() {
+ assertEquals(obtainInputValue(), getValue(),
+ format("The input value on coordinates x:{0}, y:{1} does not match: ", x, y));
+ }
+
+ public void checkOutputValue() {
+ assertEquals(obtainOutputValue(), getValue(),
+ format("The output value on coordinates x:{0}, y:{1} does not match: ", x, y));
+ }
+
+ public int getValue() {
+ return matrix.get(x - 1).get(y - 1);
+ }
+
+ public void setValue(int value) {
+ matrix.get(x - 1).set(y - 1, value);
+ }
+
+ public void addValue(int delta) {
+ matrix.get(x - 1).set(y - 1, getValue() + delta);
+ }
+
+ private JQueryLocator getInputCell() {
+ return inputRow.getNthOccurence(y).getDescendant(column).getNthOccurence(x);
+ }
+
+ private JQueryLocator getOutputCell() {
+ return outputRow.getNthOccurence(y).getDescendant(column).getNthOccurence(x);
+ }
+ }
+
+ private abstract class MatrixCommand {
+ public abstract void processCell(int x, int y);
+
+ public void processAll() {
+ for (int x = 1; x <= columns; x++) {
+
+ for (int y = 1; y <= rows; y++) {
+
+ processCell(x, y);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
14 years, 3 months
JBoss Rich Faces SVN: r19308 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-22 07:04:00 -0400 (Wed, 22 Sep 2010)
New Revision: 19308
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
Log:
RFPL-674
* testBypassUpdates, testImmediate and testItemchangeEvents refactored
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-09-22 09:12:46 UTC (rev 19307)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-09-22 11:04:00 UTC (rev 19308)
@@ -19,7 +19,6 @@
* 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.richAccordion;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
@@ -32,6 +31,7 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+import javax.faces.event.PhaseId;
import org.jboss.test.selenium.css.CssProperty;
import org.jboss.test.selenium.dom.Event;
@@ -39,7 +39,6 @@
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.ajax.JavaScriptCondition;
import org.jboss.test.selenium.waiting.conditions.IsDisplayed;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.Test;
@@ -68,20 +67,20 @@
@Test
public void testInit() {
- boolean isDisplayed = selenium.isDisplayed(accordion);
- assertTrue(isDisplayed, "Accordion is not present on the page.");
+ boolean accordionDisplayed = selenium.isDisplayed(accordion);
+ assertTrue(accordionDisplayed, "Accordion is not present on the page.");
for (int i = 0; i < 5; i++) {
- isDisplayed = selenium.isDisplayed(itemHeaders[i]);
- assertTrue(isDisplayed, "Item" + (i + 1) + "'s header should be visible.");
+ accordionDisplayed = selenium.isDisplayed(itemHeaders[i]);
+ assertTrue(accordionDisplayed, "Item" + (i + 1) + "'s header should be visible.");
}
- isDisplayed = selenium.isDisplayed(itemContents[0]);
- assertTrue(isDisplayed, "Content of item1 should be visible.");
+ accordionDisplayed = selenium.isDisplayed(itemContents[0]);
+ assertTrue(accordionDisplayed, "Content of item1 should be visible.");
for (int i = 1; i < 5; i++) {
- isDisplayed = selenium.isDisplayed(itemContents[i]);
- assertFalse(isDisplayed, "Item" + (i + 1) + "'s content should not be visible.");
+ accordionDisplayed = selenium.isDisplayed(itemContents[i]);
+ assertFalse(accordionDisplayed, "Item" + (i + 1) + "'s content should not be visible.");
}
}
@@ -138,15 +137,7 @@
selenium.click(itemHeaders[2]);
waitGui.failWith("Item 3 is not displayed.").until(isDisplayed.locator(itemContents[2]));
- JQueryLocator[] phases = {jq("div#phasesPanel li"), jq("div#phasesPanel li:eq(0)"),
- jq("div#phasesPanel li:eq(1)"), jq("div#phasesPanel li:eq(2)"), jq("div#phasesPanel li:eq(3)")};
-
- final String msg = "Update model values and Invoke application phases should be skipped.";
- assertEquals(selenium.getCount(phases[0]), 4, msg);
- assertEquals(selenium.getText(phases[1]), phasesNames[0], msg);
- assertEquals(selenium.getText(phases[2]), phasesNames[1], msg);
- assertEquals(selenium.getText(phases[3]), phasesNames[2], msg);
- assertEquals(selenium.getText(phases[4]), phasesNames[5], msg);
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -225,14 +216,7 @@
selenium.click(itemHeaders[2]);
waitGui.failWith("Item 3 is not displayed.").until(isDisplayed.locator(itemContents[2]));
- JQueryLocator[] phases = {jq("div#phasesPanel li"), jq("div#phasesPanel li:eq(0)"),
- jq("div#phasesPanel li:eq(1)"), jq("div#phasesPanel li:eq(2)")};
-
- final String msg = "Process validations, Update model values and Invoke application phases should be skipped.";
- assertEquals(selenium.getCount(phases[0]), 3, msg);
- assertEquals(selenium.getText(phases[1]), phasesNames[0], msg);
- assertEquals(selenium.getText(phases[2]), phasesNames[1], msg);
- assertEquals(selenium.getText(phases[3]), phasesNames[5], msg);
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -262,33 +246,23 @@
@Test
public void testItemchangeEvents() {
- JQueryLocator obicInput = pjq("input[id$=onbeforeitemchangeInput]");
- JQueryLocator oicInput = pjq("input[id$=onitemchangeInput]");
- final String obicValue = "alert('onbeforeitemchange')";
- final String oicValue = "alert('onitemchange')";
+ JQueryLocator time = jq("span[id$=requestTime]");
- selenium.type(obicInput, obicValue);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.type(oicInput, oicValue);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.type(pjq("input[type=text][id$=onbeforeitemchangeInput]"), "metamerEvents += \"beforeitemchange \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onitemchangeInput]"), "metamerEvents += \"itemchange \"");
+ selenium.waitForPageToLoad();
- selenium.click(itemHeaders[2]);
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+ String time1Value = selenium.getText(time);
- waitGui.until(new JavaScriptCondition() {
- public JavaScript getJavaScriptCondition() {
- return new JavaScript("selenium.isAlertPresent()");
- }
- });
+ guardXhr(selenium).click(itemHeaders[2]);
+ waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time));
- assertEquals(selenium.getAlert(), "onbeforeitemchange", "Event beforeitemchange was not fired");
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- waitGui.until(new JavaScriptCondition() {
- public JavaScript getJavaScriptCondition() {
- return new JavaScript("selenium.isAlertPresent()");
- }
- });
-
- assertEquals(selenium.getAlert(), "onitemchange", "Event itemchange was not fired");
+ assertEquals(events[0], "beforeitemchange", "Attribute onbeforeitemchange doesn't work");
+ assertEquals(events[1], "itemchange", "Attribute onbeforeitemchange doesn't work");
}
@Test
14 years, 3 months
JBoss Rich Faces SVN: r19307 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-09-22 05:12:46 -0400 (Wed, 22 Sep 2010)
New Revision: 19307
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
https://jira.jboss.org/browse/RF-9301
bugfix after style classes renaming
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-22 07:41:46 UTC (rev 19306)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-22 09:12:46 UTC (rev 19307)
@@ -82,7 +82,7 @@
@Attribute
public abstract String getFilterFunction();
- @Attribute(defaultValue = "rf-au-select")
+ @Attribute(defaultValue = "rf-au-sel")
public abstract String getSelectedItemClass();
@Attribute
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss 2010-09-22 07:41:46 UTC (rev 19306)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss 2010-09-22 09:12:46 UTC (rev 19307)
@@ -79,6 +79,15 @@
list-style-type: none;
}
+.rf-au-sel{
+ padding: 1px;
+ width: 100%;
+ background-color: '#{richSkin.headerBackgroundColor}';
+ border-width: 1px;
+ border-style: dotted;
+ border-color: '#{richSkin.generalTextColor}';
+}
+
.rf-au-shdw{
border: 0px solid red;
display: inline-block;
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-22 07:41:46 UTC (rev 19306)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-22 09:12:46 UTC (rev 19307)
@@ -115,8 +115,8 @@
var $super = rf.ui.Autocomplete.$super;
var defaultOptions = {
- selectedItemClass:'rf-au-select',
- itemClass:'rf-au-option',
+ selectedItemClass:'rf-au-sel',
+ itemClass:'rf-au-opt',
autofill:true,
minChars:1,
selectFirst:true,
14 years, 3 months
JBoss Rich Faces SVN: r19306 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-22 03:41:46 -0400 (Wed, 22 Sep 2010)
New Revision: 19306
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml
Log:
initial tests for a4j:repeat - simple sample (RFPL-819)
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml 2010-09-22 06:45:55 UTC (rev 19305)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml 2010-09-22 07:41:46 UTC (rev 19306)
@@ -59,20 +59,23 @@
rows="#{a4jRepeatBean.attributes['rows'].value}"
value="#{a4jRepeatBean.dataList}"
var="item">
- <li><h:inputText value="#{item.text}" />
+ <li>
+ <h:inputText value="#{item.text}" />
<h:commandLink value="Link">
<f:ajax render="@form" execute="@form" />
<f:setPropertyActionListener target="#{a4jRepeatBean.selectedDataItem}" value="#{item}" />
</h:commandLink>
- <h:outputText id="statusBegin" value="begin=#{status.begin}, "/>
- <h:outputText id="statusEnd" value="end=#{status.end}, "/>
- <h:outputText id="statusIndex" value="index=#{status.index}, "/>
- <h:outputText id="statusCount" value="count=#{status.count}, "/>
- <h:outputText id="statusFirst" value="first=#{status.first}, "/>
- <h:outputText id="statusLast" value="last=#{status.last}, "/>
- <h:outputText id="statusEven" value="even=#{status.even}, "/>
- <h:outputText id="statusRowCount" value="rowCount=#{status.rowCount}"/>
+ <a4j:outputPanel styleClass="statuses">
+ <h:outputText id="statusBegin" value="begin=#{status.begin}, "/>
+ <h:outputText id="statusEnd" value="end=#{status.end}, "/>
+ <h:outputText id="statusIndex" value="index=#{status.index}, "/>
+ <h:outputText id="statusCount" value="count=#{status.count}, "/>
+ <h:outputText id="statusFirst" value="first=#{status.first}, "/>
+ <h:outputText id="statusLast" value="last=#{status.last}, "/>
+ <h:outputText id="statusEven" value="even=#{status.even}, "/>
+ <h:outputText id="statusRowCount" value="rowCount=#{status.rowCount}"/>
+ </a4j:outputPanel>
</li>
</a4j:repeat>
</ul>
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java 2010-09-22 07:41:46 UTC (rev 19306)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jRepeat;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class RepeatAttributes extends AbstractComponentAttributes {
+
+ public RepeatAttributes() {
+ }
+
+ public RepeatAttributes(ExtendedLocator<JQueryLocator> root) {
+ super(root);
+ }
+
+ public void setFirst(int first) {
+ setProperty("first", first);
+ }
+
+ public void setRendered(boolean rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setRows(int rows) {
+ setProperty("rows", rows);
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/SimpleModel.java 2010-09-22 07:41:46 UTC (rev 19306)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jRepeat;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class SimpleModel {
+
+ private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ JQueryLocator row = jq("#list li");
+ JQueryLocator statuses = jq("span.statuses");
+
+ Map<Integer, String> texts = new HashMap<Integer, String>();
+
+ public boolean isRendered() {
+ return selenium.isElementPresent(row);
+ }
+
+ public int getTotalRowCount() {
+ return selenium.getCount(row);
+ }
+
+ public int getBegin(int position) {
+ return Integer.valueOf(getValue("begin", position));
+ }
+
+ public int getEnd(int position) {
+ return Integer.valueOf(getValue("end", position));
+ }
+
+ public int getIndex(int position) {
+ return Integer.valueOf(getValue("index", position));
+ }
+
+ public int getCount(int position) {
+ return Integer.valueOf(getValue("count", position));
+ }
+
+ public boolean isFirst(int position) {
+ return Boolean.valueOf(getValue("first", position));
+ }
+
+ public boolean isLast(int position) {
+ return Boolean.valueOf(getValue("last", position));
+ }
+
+ public boolean isEven(int position) {
+ return Boolean.valueOf(getValue("even", position));
+ }
+
+ public int getRowCount(int position) {
+ return Integer.valueOf(getValue("rowCount", position));
+ }
+
+ private String getValue(String name, int position) {
+ String obtained;
+ if (texts.containsKey(position)) {
+ obtained = texts.get(position);
+ } else {
+ JQueryLocator locator = getRowOnPosition(position).getDescendant(statuses);
+ obtained = selenium.getText(locator);
+ texts.put(position, obtained);
+ }
+ return parseValue(name, obtained);
+ }
+
+ private JQueryLocator getRowOnPosition(int position) {
+ return row.getNthOccurence(position);
+ }
+
+ private String parseValue(String name, String text) {
+ Pattern pattern = Pattern.compile(format("(?:^|.* ){0}=([^,]+)(?:,.*|$)", name));
+ Matcher matcher = pattern.matcher(text);
+ if (!matcher.find()) {
+ throw new IllegalArgumentException(format("the text '{0}' cannot be parsed", text));
+ }
+ return matcher.group(1);
+ }
+}
\ No newline at end of file
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java 2010-09-22 07:41:46 UTC (rev 19306)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.a4jRepeat;
+
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+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.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestSimple extends AbstractMetamerTest {
+
+ protected static final int ELEMENTS_TOTAL = 20;
+
+ SimpleModel model;
+ RepeatAttributes attributes = new RepeatAttributes();
+
+ @Inject
+ @Use(empty = false)
+ Integer first;
+
+ @Inject
+ @Use(empty = false)
+ Integer rows;
+
+ int expectedFirst;
+ int expectedRows;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jRepeat/simple.xhtml");
+ }
+
+ @BeforeMethod
+ public void prepareAttributes() {
+ model = new SimpleModel();
+
+ if (first != null) {
+ attributes.setFirst(first);
+ }
+ if (rows != null) {
+ attributes.setRows(rows);
+ }
+ }
+
+ @Test
+ public void testRenderedAttribute() {
+ attributes.setRendered(false);
+ assertEquals(model.isRendered(), false);
+ }
+
+ @Test
+ @Use(field = "first", ints = { -2, -1, 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ ELEMENTS_TOTAL + 1 })
+ public void testFirstAttribute() {
+ verifyRepeat();
+ }
+
+ @Test
+ @Use(field = "rows", ints = { -2, -1, 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ ELEMENTS_TOTAL + 1 })
+ public void testRowsAttribute() {
+ verifyRepeat();
+ }
+
+ private void verifyRepeat() {
+ countExpectedValues();
+ verifyCounts();
+ verifyRows();
+ }
+
+ private void verifyCounts() {
+ assertEquals(model.getTotalRowCount(), expectedRows);
+ if (expectedRows > 0) {
+ assertEquals(model.getIndex(1), expectedFirst);
+ }
+ }
+
+ private void verifyRows() {
+ int rowCount = model.getTotalRowCount();
+ for (int position = 1; position <= rowCount; position++) {
+ assertEquals(model.getBegin(position), expectedFirst, "begin");
+ assertEquals(model.getEnd(position), expectedFirst + expectedRows - 1, "end");
+ assertEquals(model.getIndex(position), expectedFirst + position - 1, "index");
+ assertEquals(model.getCount(position), position, "count");
+ assertEquals(model.isFirst(position), position == 1, "first");
+ assertEquals(model.isLast(position), position == rowCount, "last");
+ assertEquals(model.isEven(position), (position % 2) == 0, "even");
+ // TODO fails because of rowCount on page doesn't eqaul to rowCount, but ELEMENTS_TOTAL
+ // assertEquals(model.getRowCount(position), rowCount, "rowCount");
+ }
+ }
+
+ private void countExpectedValues() {
+ if (first == null || first < 0) {
+ expectedFirst = 0;
+ } else {
+ expectedFirst = first;
+ }
+
+ if (rows == null || rows < 1 || rows > ELEMENTS_TOTAL) {
+ expectedRows = ELEMENTS_TOTAL;
+ } else {
+ expectedRows = rows;
+ }
+
+ expectedFirst = minMax(0, expectedFirst, ELEMENTS_TOTAL);
+ expectedRows = min(expectedRows, ELEMENTS_TOTAL - expectedFirst);
+ }
+
+ private int minMax(int min, int value, int max) {
+ return max(0, min(max, value));
+ }
+}
\ No newline at end of file
14 years, 3 months