Author: ppitonak(a)redhat.com
Date: 2011-02-09 12:23:35 -0500 (Wed, 09 Feb 2011)
New Revision: 21574
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richSelect/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java
Log:
* added 9 new tests for rich:select
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java 2011-02-09
17:15:10 UTC (rev 21573)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichSelectBean.java 2011-02-09
17:23:35 UTC (rev 21574)
@@ -77,7 +77,11 @@
// TODO has to be tested in another way
attributes.remove("converter");
+ attributes.remove("converterMessage");
+ attributes.remove("required");
+ attributes.remove("requiredMessage");
attributes.remove("validator");
+ attributes.remove("validatorMessage");
attributes.remove("valueChangeListener");
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richSelect/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richSelect/simple.xhtml 2011-02-09
17:15:10 UTC (rev 21573)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richSelect/simple.xhtml 2011-02-09
17:23:35 UTC (rev 21574)
@@ -40,10 +40,12 @@
</ui:define>
<ui:define name="component">
+ <h:selectOneMenu immediate="true" value=""
<rich:select id="select"
changedStateClass="#{richSelectBean.attributes['changedStateClass'].value}"
converterMessage="#{richSelectBean.attributes['converterMessage'].value}"
defaultLabel="#{richSelectBean.attributes['defaultLabel'].value}"
+
disabled="#{richSelectBean.attributes['disabled'].value}"
disabledStateClass="#{richSelectBean.attributes['disabledStateClass'].value}"
editStateClass="#{richSelectBean.attributes['editStateClass'].value}"
enableManualInput="#{richSelectBean.attributes['enableManualInput'].value}"
@@ -52,6 +54,8 @@
listClass="#{richSelectBean.attributes['listClass'].value}"
listHeight="#{richSelectBean.attributes['listHeight'].value}"
listWidth="#{richSelectBean.attributes['listWidth'].value}"
+
maxListHeight="#{richSelectBean.attributes['maxListHeight'].value}"
+
minListHeight="#{richSelectBean.attributes['minListHeight'].value}"
onblur="#{richSelectBean.attributes['onblur'].value}"
onchange="#{richSelectBean.attributes['onchange'].value}"
onclick="#{richSelectBean.attributes['onclick'].value}"
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-02-09
17:15:10 UTC (rev 21573)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-02-09
17:23:35 UTC (rev 21574)
@@ -81,17 +81,15 @@
protected TextRetriever retrieveRenderChecker =
retrieveText.locator(jq("#renderChecker"));
protected TextRetriever retrieveStatusChecker =
retrieveText.locator(jq("#statusCheckerOutput"));
protected PhaseInfo phaseInfo = new PhaseInfo();
-
protected LocatorReference<JQueryLocator> attributesRoot = new
LocatorReference<JQueryLocator>(
- pjq("span[id$=:attributes:panel]"));
-
+ pjq("span[id$=:attributes:panel]"));
/**
* timeout in miliseconds
*/
public static final long TIMEOUT = 5000;
@Inject
- @Templates({ "plain", "richDataTable1,redDiv",
"richDataTable2,redDiv", "a4jRepeat1", "a4jRepeat2",
"hDataTable1",
- "hDataTable2", "uiRepeat1", "uiRepeat2" })
+ @Templates({"plain", "richDataTable1,redDiv",
"richDataTable2,redDiv", "a4jRepeat1", "a4jRepeat2",
"hDataTable1",
+ "hDataTable2", "uiRepeat1", "uiRepeat2"})
private TemplatesList template;
/**
@@ -201,7 +199,7 @@
selenium.fireEvent(element, event);
waitGui.failWith("Attribute on" + attributeName + " does not work
correctly").until(
- new EventFiredCondition(event));
+ new EventFiredCondition(event));
}
/**
@@ -244,10 +242,8 @@
* name of the attribute that will be set (e.g. styleClass, headerClass,
itemContentClass)
*/
protected void testStyleClass(ExtendedLocator<JQueryLocator> element, String
attribute) {
- ElementLocator<?> classInput = ref(attributesRoot, "input[id$=" +
attribute + "Input]");
final String styleClass = "metamer-ftest-class";
-
- selenium.type(classInput, styleClass);
+ selenium.type(ref(attributesRoot, "input[id$=" + attribute +
"Input]"), styleClass);
selenium.waitForPageToLoad();
JQueryLocator elementWhichHasntThatClass = jq(element.getRawLocator() +
":not(.{0})").format(styleClass);
@@ -269,9 +265,9 @@
public void testRequestEventsAfter(String... events) {
String[] actualEvents = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
assertEquals(
- actualEvents,
- events,
- format("The events ({0}) don't came in right order ({1})",
Arrays.deepToString(actualEvents),
+ actualEvents,
+ events,
+ format("The events ({0}) don't came in right order ({1})",
Arrays.deepToString(actualEvents),
Arrays.deepToString(events)));
}
@@ -370,7 +366,7 @@
selenium.waitForPageToLoad();
assertTrue(selenium.getAttribute(attr).contains(value), "Attribute " +
attribute + " should contain \"" + value
- + "\".");
+ + "\".");
}
/**
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java 2011-02-09
17:15:10 UTC (rev 21573)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java 2011-02-09
17:23:35 UTC (rev 21574)
@@ -30,6 +30,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;
@@ -140,6 +141,21 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10479")
+ public void testChangedStateClass() {
+ selenium.type(pjq("input[id$=changedStateClassInput]"),
"metamer-ftest-class");
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(button);
+ selenium.mouseUp(button);
+ selenium.click(options.format(10));
+ guardXhr(selenium).fireEvent(input, Event.BLUR);
+ waitGui.failWith("Bean was not
updated").until(textEquals.locator(output).text("Hawaii"));
+
+ assertTrue(selenium.belongsClass(select, "metamer-ftest-class"),
"Attribute changedStateClass doesn't work.");
+ }
+
+ @Test
public void testDefaultLabel() {
selenium.type(pjq("input[type=text][id$=defaultLabelInput]"), "new
label");
selenium.waitForPageToLoad();
@@ -157,6 +173,40 @@
}
@Test
+ public void testDisabled() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=valueInput]"),
"Hawaii");
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(select), "Inplace input is not on the
page.");
+ assertTrue(selenium.isElementPresent(button), "Button should be present on
the page.");
+ assertTrue(selenium.isElementPresent(input), "Input should be present on the
page.");
+ assertEquals(selenium.getValue(input), "Hawaii", "Value of
input");
+ assertFalse(selenium.isVisible(popup), "Popup should not be visible on the
page.");
+ assertTrue(selenium.belongsClass(button, "rf-sel-btn-dis"),
"Button should contain class rf-sel-btn-dis.");
+ AttributeLocator disabledAttr = input.getAttribute(new
Attribute("disabled"));
+ assertTrue(selenium.isAttributePresent(disabledAttr), "Input should be
disabled.");
+ assertEquals(selenium.getAttribute(disabledAttr), "disabled",
"Input should be disabled.");
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10479")
+ public void testDisabledStateClass() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ testStyleClass(select, "disabledStateClass");
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10479")
+ public void testEditStateClass() {
+ testStyleClass(select, "editStateClass");
+ }
+
+ @Test
@IssueTracking("https://issues.jboss.org/browse/RF-9855")
public void testEnableManualInput() {
selenium.click(pjq("input[type=radio][name$=enableManualInputInput][value=false]"));
@@ -177,6 +227,23 @@
}
@Test
+ public void testImmediate() {
+
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.mouseDown(button);
+ selenium.mouseUp(button);
+ selenium.click(options.format(10));
+ guardXhr(selenium).fireEvent(input, Event.BLUR);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "value changed: ->
Hawaii");
+ }
+
+ @Test
public void testItemClass() {
final String value = "metamer-ftest-class";
selenium.type(pjq("input[type=text][id$=itemClassInput]"), value);
@@ -232,6 +299,42 @@
}
@Test
+ public void testMaxListHeight() {
+ selenium.type(pjq("input[type=text][id$=maxListHeightInput]"),
"300px");
+ selenium.waitForPageToLoad();
+
+ String height = selenium.getStyle(jq("div.rf-sel-lst-scrl"), new
CssProperty("max-height"));
+ assertEquals(height, "300px", "Height of list did not
change");
+
+ selenium.type(pjq("input[type=text][id$=maxListHeightInput]"),
"");
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(button);
+ selenium.mouseUp(button);
+ assertTrue(selenium.isVisible(popup), "Popup should be displayed.");
+
+ assertEquals(selenium.getElementHeight(jq("div.rf-sel-lst-scrl")), 100,
"Height of list did not change");
+ }
+
+ @Test
+ public void testMinListHeight() {
+ selenium.type(pjq("input[type=text][id$=minListHeightInput]"),
"300px");
+ selenium.waitForPageToLoad();
+
+ String height = selenium.getStyle(jq("div.rf-sel-lst-scrl"), new
CssProperty("min-height"));
+ assertEquals(height, "300px", "Height of list did not
change");
+
+ selenium.type(pjq("input[type=text][id$=minListHeightInput]"),
"");
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(button);
+ selenium.mouseUp(button);
+ assertTrue(selenium.isVisible(popup), "Popup should be displayed.");
+
+ assertEquals(selenium.getElementHeight(jq("div.rf-sel-lst-scrl")), 100,
"Height of list did not change");
+ }
+
+ @Test
public void testOnblur() {
testFireEvent(Event.BLUR, input);
}
@@ -367,6 +470,12 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10479")
+ public void testReadyStateClass() {
+ testStyleClass(select, "readyStateClass");
+ }
+
+ @Test
public void testRendered() {
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
@@ -474,4 +583,12 @@
waitGui.failWith("Bean was not
updated").until(textEquals.locator(output).text("Hawaii"));
}
+
+ @Test
+ public void testValue() {
+ selenium.type(pjq("input[type=text][id$=valueInput]"), "North
Carolina");
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getValue(input), "North Carolina", "Input
should contain selected value.");
+ }
}